public ActionResult Hide(CommentModel model)
        {
            if (!_permissionService.Authorize(PermissionProvider.ManagePages))
                return AccessDeniedView();

            // get the comment
            var comment = _commentService.GetCommentById(model.Id);

            // check we have a comment and it's not deleted
            if (comment == null || comment.Deleted)
                return RedirectToAction("index");

            try
            {
                comment.Active = !comment.Active;
                _commentService.UpdateComment(comment);

                SuccessNotification(comment.Active ? "The comment has been reshown successfully." : "The comment has been hidden successfully.");
                return RedirectToAction("edit", comment.Id);
            }
            catch (Exception)
            {
                ErrorNotification("An error occurred hiding the comment, please try again.");
            }

            PrepareBreadcrumbs();
            AddBreadcrumb("Edit Comment", null);

            return View(model);
        }
        public static CommentModel ToModel(this Comment entity)
        {
            if (entity == null)
                return null;

            var model = new CommentModel
            {
                Active = entity.Active,
                Author = entity.Author.ToModel(),
                CreatedDate = entity.CreatedDate,
                Deleted = entity.Deleted,
                Id = entity.Id,
                LastModifiedDate = entity.LastModifiedDate,
                ModerationRequestCount = entity.ModerationRequestCount,
                Responses = entity.Responses.Select(ToModel).OrderBy(x => x.CreatedDate).ToList(),
                UserComment = entity.UserComment,
            };

            return model;
        }
        public ActionResult Edit(CommentModel model)
        {
            if (!_permissionService.Authorize(PermissionProvider.ManageComments))
                return AccessDeniedView();

            var comment = _commentService.GetCommentById(model.Id);

            if (comment == null || comment.Deleted)
                return RedirectToAction("index");

            comment.UserComment = model.UserComment;

            if(ModelState.IsValid)
            {
                try
                {
                    _commentService.UpdateComment(comment);
                    SuccessNotification("The comments details have been updated successfully.");
                    return RedirectToAction("Edit", comment.Id);
                }
                catch (Exception)
                {
                    ErrorNotification("An error occurred saving the comment details, please try again.");
                }
            }

            PrepareBreadcrumbs();
            AddBreadcrumb("Edit Comment", null);

            model = PrepareCommentModel(comment);
            return View(model);
        }