public JsonResult GetMessages(int otherUserId) { User currentUser = GetProperty(SessionVariableNames.Current_User) as User; if (currentUser == null) { GetEmailIdAndRefreshUserSession(true); currentUser = GetProperty(SessionVariableNames.Current_User) as User; } List <Message> messages = DALayer.GetMessages(currentUser.UserId, otherUserId); return(Json(messages, JsonRequestBehavior.AllowGet)); }