public IHttpActionResult CheckExistConversation(string conName)
 {
     try
     {
         var loginUserId  = User.Identity.GetUserId();
         var conversation = _context.Conversations.FirstOrDefault(c => c.Name == conName);
         if (conversation != null)
         {
             var model = ConversationModel.Create(_context, conversation.Id);
             return(Json(model));
         }
         var newConName      = String.Join("_", conName.Split('_').Reverse());
         var newConversation = _context.Conversations.FirstOrDefault(c => c.Name == newConName);
         if (newConversation != null)
         {
             var model = ConversationModel.Create(_context, newConversation.Id);
             return(Json(model));
         }
         return(Json(false));
     }
     catch (Exception ex)
     {
         return(Json("error"));
     }
 }
 public IHttpActionResult GetOldMessagesByConversationId(string conId)
 {
     try
     {
         var loginUserId  = User.Identity.GetUserId();
         var conversation = _context.Conversations.FirstOrDefault(c => c.Id == conId);
         if (conversation != null)
         {
             var model = new ConversationModel();
             model = ConversationModel.Create(_context, conversation.Id);
             return(Json(model));
         }
         return(Json(false));
     }
     catch (Exception ex)
     {
         return(Json("error"));
     }
 }