title: SignalR saving / retrieving messages from conversation
body: <p>I'm having problem saving messages in sql DB. I'm using this project 
  <a href="http://www.codeproject.com/Articles/732190/Real-Time-Web-Solution-for-Chat-by-MVC-SignalR-H?msg=5059882#xx5059882xx" rel="nofollow">http://www.codeproject.com/Articles/732190/Real-Time-Web-Solution-for-Chat-by-MVC-SignalR-H?msg=5059882#xx5059882xx</a></p>
  
  <p>I'm saving every message in DB when I click the send button.</p>
  
  <p>On the server side on the hub class I have:</p>
  
  <pre><code>public void SendMessageToGroup(string userName, string message, int UserID)
  {
  
      if (UsersList.Count != 0)
      {
          var strg = (from s in UsersList where (s.UserName == userName) select s).First();
          MessageList.Add(new MessageInfo { UserName = userName, Message = message, UserGroup = strg.UserGroup, MsgDate = DateTime.Now.ToString() });
          string strgroup = strg.UserGroup;
          //string UserID = strg.UserID;
          saveMessagetoDB(userName, message, DateTime.Now.ToString(), UserID);
          // If you want to Broadcast message to all UsersList use below line
          // Clients.All.getMessages(userName, message);
  
          //If you want to establish peer to peer connection use below line so message will be send just for user and admin who are in same group
          //***** Return to Client *****
          Clients.Group(strgroup).getMessages(userName, message, DateTime.Now.ToString());
      }
  
  }
  </code></pre>
  
  <p>And on the client side, I have:</p>
  
  <pre><code> $('#btnSendMessage').click(function () {
         var userName = $('#hUserName').val();
         var UserID = $('#hUserId').val();
         var msg = $("#txtMessage").val();
  
  
  
         if (msg.length &gt; 0) {
  
             //// &lt;&lt;&lt;&lt;&lt;-- ***** Return to Server [  SaveMessagetoDB  ] *****
             //objHub.server.saveMessagetoDB(userName, msg, msgDate);
             // &lt;&lt;&lt;&lt;&lt;-- ***** Return to Server [  SendMessageToGroup  ] *****
             objHub.server.sendMessageToGroup(userName, msg, UserID);
  
         }
     });
  </code></pre>
  
  <p>My problem is that I'm not saving the receiverID / username and I don't know where I have to pass it as a parameter. Withou that reveiverID/username I can't retrieve message history between these two users.</p>
  
  <p>How can i resolve this?</p>