public bool ValidateClient(HttpRequestMessage request, ref string error, ref Client client) { var clientId = request.GetValueFromQueryString("client_id"); if (string.IsNullOrWhiteSpace(clientId)) { error = "client_Id is required"; return(false); } var findedClient = _repo.FindClient(clientId); if (findedClient == null) { error = string.Format("Client_id '{0}' is not registered in the system.", findedClient.Id); return(false); } client = findedClient; return(true); }