public async Task<IActionResult> List()
        {
            var user = await _userManager.FindByIdAsync(User.GetUserId());
            var conversations = await _conversationManager.GetUserConversations(user.Id);

            var viewModels = new List<ConversationVM>();

            foreach (var conversation in conversations)
            {
                var conversationVM = new ConversationVM();

                conversationVM.ConversationId = conversation.Id.ToString();
                conversationVM.Name = conversation.Name;

                var lastMessage = conversation.Messages.OrderByDescending(m => m.SentOn).FirstOrDefault();
                var messageUser = await _userManager.FindByIdAsync(lastMessage.UserIdFrom.ToString());

                conversationVM.Messages.Add(MessageMapper.MapMessageToViewModel(lastMessage, messageUser.UserName));

                viewModels.Add(conversationVM);
            }

            return View(viewModels);
        }
        public async Task<JsonResult> OpenConversation(string conversationId)
        {
            var result = new JsonServiceResult<ConversationVM>();

            try
            {
                var conversation = await _conversationManager.GetConversationById(conversationId);
                var conversationVM = new ConversationVM();

                conversationVM.ConversationId = conversation.Id.ToString();
                conversationVM.Name = conversation.Name;

                foreach (var message in conversation.Messages)
                {
                    var messageUser = await _userManager.FindByIdAsync(message.UserIdFrom.ToString());
                    conversationVM.Messages.Add(MessageMapper.MapMessageToViewModel(message, messageUser.UserName));
                }

                result.Value = conversationVM;
                result.IsValid = true;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }

            return Json(result);
        }