public ActionResult Index(SubmitCommentRenderingModel model)
        {
            var comment = BuildComment(model);
            var result  = ValidateCommentCore.Validate(comment, HttpContext.Request.Form);

            if (ModelState.IsValid && result.Success)
            {
                var submissionResult = SubmitCommentCore.Submit(comment);
                if (submissionResult.IsNull)
                {
                    Session["Submitted"] = false;
                }
                else
                {
                    Session["Submitted"] = true;
                }
                return(Redirect(HttpContext.Request.Url.AbsoluteUri));
            }

            foreach (var error in result.Errors)
            {
                ModelState.AddModelError(string.Empty, error);
            }

            TempData["ScrollTo"] = true;
            return(View("~/Views/WeBlog/SubmitComment.cshtml"));
        }
        protected void buttonSaveComment_Click(object sender, EventArgs e)
        {
            if (MessagePanel != null)
            {
                MessagePanel.Visible = false;
            }
            if (Page.IsValid)
            {
                Comment comment = new Comment
                {
                    AuthorName  = GetFormValue(txtCommentName),
                    AuthorEmail = GetFormValue(txtCommentEmail),
                    Text        = GetFormValue(txtCommentText)
                };
                comment.Fields.Add(Constants.Fields.Website, GetFormValue(txtCommentWebsite));
                comment.Fields.Add(Constants.Fields.IpAddress, Context.Request.UserHostAddress);

                var result = ValidateCommentCore.Validate(comment, Request.Form);

                ID submissionResult = null;

                if (result.Success)
                {
                    submissionResult = SubmitCommentCore.Submit(comment);
                    if (submissionResult.IsNull)
                    {
                        SetErrorMessage(Translator.Text("COMMENT_SUBMIT_ERROR"));
                    }
                    else
                    {
                        SetSuccessMessage(Translator.Text("COMMENT_SUBMIT_SUCCESS"));
                        ResetCommentFields();
                    }
                }
                else
                {
                    var text = string.Join(", ", result.Errors);
                    SetErrorMessage(text);
                }

                //check if added comment is available. if so, send it along with the event
                //won't happen unless publishing and indexing is really fast, but worth a try
                var         newCommentReference = CommentManager.GetEntryComments(Sitecore.Context.Item, int.MaxValue).SingleOrDefault(item => item.Uri.ItemID == submissionResult);
                CommentItem newComment          = null;

                if (newCommentReference != null)
                {
                    newComment = Database.GetItem(newCommentReference.Uri);
                }

                Sitecore.Events.Event.RaiseEvent(Constants.Events.UI.COMMENT_ADDED, new object[] { newComment });

                //display javascript to scroll right to the comments list
                CommentScroll.Visible = true;
            }
        }