public static string SentEmailHash(int userid, int questionid) { using (var db = new QaAContext()) { var hash = MyHelpers.MD5Encode("u" + userid.ToString() + "q" + questionid.ToString()); db.EmailIdentifiers.Add(new EmailIdentifier { UserId = userid, QuestionId = questionid, Hash = hash }); db.SaveChanges(); return(hash); } }