public async Task <IActionResult> GetConversation(int userId, int recipientId) { if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var messagesFromRepo = await _repo.GetConversation(userId, recipientId); var messageToReturn = _mapper.Map <IEnumerable <MessageToReturnDto> >(messagesFromRepo); return(Ok(messageToReturn)); }