private SessionModel CreateSessionCookie(UserModel user) { var session = SessionModel.CreateSession(); var cookieOptions = SessionModel.CreateCookieOptions(session); Response.Cookies.Append("session", session.Id.ToString(), cookieOptions); session.UserId = user.Id; user.sessionsId = new ObjectId[] { session.Id }; Database.InsertDocument(session); return(session); }