public HttpResponseMessage GetMessagesByConversations(int id, [ValueProvider(typeof(HeaderValueProviderFactory <String>))] String sessionKey) { var user = usersRepository.GetBySessionKey(sessionKey); if (user == null) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid session key")); } return(Request.CreateResponse(HttpStatusCode.OK, messagesRepository.GetByConversation(id))); }