public ActionResult Create([Bind(Include = "Id,Title,Content,UserId,UserName")] Comment comment) { comment.UserId = User.Identity.GetUserId(); comment.UserName = User.Identity.GetUserName(); ModelState.Clear(); TryValidateModel(comment); if (ModelState.IsValid) { string EncodedResponse = Request.Form["g-recaptcha-response"]; bool isCaptchaValid = (ReCaptchaClass.Validate(EncodedResponse) == "true" ? true : false); if (isCaptchaValid) { db.Comments.Add(comment); db.SaveChanges(); return(RedirectToAction("Index")); } else { TempData["recaptcha"] = "Please verify you are not a robot"; } } return(View(comment)); }