public ActionResult Index(CommentIndexOptions options) {
            // Default options
            if (options == null)
                options = new CommentIndexOptions();

            // Filtering
            IEnumerable<Comment> comments;
            try {
                switch (options.Filter) {
                    case CommentIndexFilter.All:
                        comments = _commentService.GetComments();
                        break;
                    case CommentIndexFilter.Approved:
                        comments = _commentService.GetComments(CommentStatus.Approved);
                        break;
                    case CommentIndexFilter.Pending:
                        comments = _commentService.GetComments(CommentStatus.Pending);
                        break;
                    case CommentIndexFilter.Spam:
                        comments = _commentService.GetComments(CommentStatus.Spam);
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }
                var entries = comments.Select(comment => CreateCommentEntry(comment.Record)).ToList();
                var model = new CommentsIndexViewModel {Comments = entries, Options = options};
                return View(model);
            }
            catch (Exception exception) {
                Services.Notifier.Error(T("Listing comments failed: " + exception.Message));
                return View(new CommentsIndexViewModel());
            }
        }
        public ActionResult Index(FormCollection input) {
            var viewModel = new CommentsIndexViewModel { Comments = new List<CommentEntry>(), Options = new CommentIndexOptions() };
            UpdateModel(viewModel);

            try {
                IEnumerable<CommentEntry> checkedEntries = viewModel.Comments.Where(c => c.IsChecked);
                switch (viewModel.Options.BulkAction) {
                    case CommentIndexBulkAction.None:
                        break;
                    case CommentIndexBulkAction.MarkAsSpam:
                        if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't moderate comment")))
                            return new HttpUnauthorizedResult();
                        //TODO: Transaction
                        foreach (CommentEntry entry in checkedEntries) {
                            _commentService.MarkCommentAsSpam(entry.Comment.Id);
                        }
                        break;
                    case CommentIndexBulkAction.Pend:
                        if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't moderate comment")))
                            return new HttpUnauthorizedResult();
                        //TODO: Transaction
                        foreach (CommentEntry entry in checkedEntries) {
                            _commentService.PendComment(entry.Comment.Id);
                        }
                        break;
                    case CommentIndexBulkAction.Approve:
                        if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't moderate comment")))
                            return new HttpUnauthorizedResult();
                        //TODO: Transaction
                        foreach (CommentEntry entry in checkedEntries) {
                            _commentService.ApproveComment(entry.Comment.Id);
                        }
                        break;
                    case CommentIndexBulkAction.Delete:
                        if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't delete comment")))
                            return new HttpUnauthorizedResult();

                        foreach (CommentEntry entry in checkedEntries) {
                            _commentService.DeleteComment(entry.Comment.Id);
                        }
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                }
            }
            catch (Exception exception) {
                Services.Notifier.Error(T("Editing comments failed: " + exception.Message));
                return RedirectToAction("Index", "Admin", new { options = viewModel.Options });
            }

            return RedirectToAction("Index");
        }
        public ActionResult Index(CommentIndexOptions options, PagerParameters pagerParameters) {
            Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);

            // Default options
            if (options == null)
                options = new CommentIndexOptions();

            // Filtering
            IContentQuery<CommentPart, CommentPartRecord> comments;
            try {
                switch (options.Filter) {
                    case CommentIndexFilter.All:
                        comments = _commentService.GetComments();
                        break;
                    case CommentIndexFilter.Approved:
                        comments = _commentService.GetComments(CommentStatus.Approved);
                        break;
                    case CommentIndexFilter.Pending:
                        comments = _commentService.GetComments(CommentStatus.Pending);
                        break;
                    case CommentIndexFilter.Spam:
                        comments = _commentService.GetComments(CommentStatus.Spam);
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }

                var pagerShape = Shape.Pager(pager).TotalItemCount(comments.Count());
                var entries = comments
                    .OrderByDescending<CommentPartRecord, DateTime?>(cpr => cpr.CommentDateUtc)
                    .Slice(pager.GetStartIndex(), pager.PageSize)
                    .ToList()
                    .Select(comment => CreateCommentEntry(comment.Record));

                var model = new CommentsIndexViewModel {
                    Comments = entries.ToList(),
                    Options = options,
                    Pager = pagerShape
                };
                return View(model);
            } catch (Exception exception) {
                this.Error(exception, T("Listing comments failed: {0}", exception.Message), Logger, Services.Notifier);

                return View(new CommentsIndexViewModel());
            }
        }