public ActionResult Index(int listId, int pageIndex)
        {
            var list = listService.GetById(listId);

            if (list == null)
            {
                return(new HttpNotFoundResult());
            }

            int totals;
            var items = listItemService.GetListItems(listId, list.Sorting, pageIndex, list.PageSize, out totals);

            var sb = new StringBuilder();

            if (!string.IsNullOrEmpty(list.CssClass))
            {
                sb.AppendFormat("<div class=\"{0}\">", list.CssClass);
            }

            if (items.Count > 0 && !string.IsNullOrEmpty(list.SummaryTemplate))
            {
                var fields = listFieldService.GetFields(listId);
                TemplateHelper.BuildContent(list, fields, items, list.SummaryTemplate, sb, Url);
            }

            TemplateHelper.BuildPagination(sb, Url, RouteData.Values, totals, pageIndex, list.PageSize);

            if (!string.IsNullOrEmpty(list.CssClass))
            {
                sb.Append("</div>");
            }

            return(new ControlContentResult(sb.ToString())
            {
                Title = list.Name
            });
        }