response = if params[:id].present?
      Contact.find_by_id(params[:id])
    else
      Contact.query(
        params[:query],