public ActionResult Choose(ChooseContentsViewModel model, PagerParameters pagerParameters)
        {
            var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
            var container = model.SourceContainerId == 0 ? null : _contentManager.GetLatest(model.SourceContainerId);
            if (container == null && model.SourceContainerId != 0) {
                return HttpNotFound();
            }
            if (string.IsNullOrEmpty(model.FilterByContentType)) {
                var targetContainer = _contentManager.Get<ContainerPart>(model.TargetContainerId);
                if (targetContainer != null) {
                    model.FilterByContentType = targetContainer.Record.ItemContentType;
                }
            }

            var query = GetListContentItemQuery(model.SourceContainerId, model.FilterByContentType, model.OrderBy);
            if (query == null) {
                return HttpNotFound();
            }

            model.SelectedFilter = model.FilterByContentType;

            model.FilterOptions = GetContainableTypes()
                .Select(ctd => new KeyValuePair<string, string>(ctd.Name, ctd.DisplayName))
                .ToList().OrderBy(kvp => kvp.Key);

            var pagerShape = Shape.Pager(pager).TotalItemCount(query.Count());
            var pageOfContentItems = query.Slice(pager.GetStartIndex(), pager.PageSize).ToList();

            var list = Shape.List();
            list.AddRange(pageOfContentItems.Select(ci => _contentManager.BuildDisplay(ci, "SummaryAdmin")));

            dynamic viewModel = Shape.ViewModel()
                .ContentItems(list)
                .Pager(pagerShape)
                .SourceContainerId(model.SourceContainerId)
                .TargetContainerId(model.TargetContainerId)
                .SelectedFilter(model.SelectedFilter)
                .FilterOptions(model.FilterOptions)
                .OrderBy(model.OrderBy)
                .Containers(_contentManager.Query<ContainerPart>(VersionOptions.Latest).List()
                    .Select(part => part.ContentItem)
                    .OrderBy(item => item.As<CommonPart>().VersionPublishedUtc));

            // Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
            return View((object)viewModel);
        }
        public ActionResult ChooseFilterPOST(ChooseContentsViewModel model)
        {
            var routeValues = ControllerContext.RouteData.Values;
            if (GetContainableTypes().Any(ctd => string.Equals(ctd.Name, model.SelectedFilter, StringComparison.OrdinalIgnoreCase))) {
                routeValues["filterByContentType"] = model.SelectedFilter;
            }
            else {
                routeValues.Remove("filterByContentType");
            }
            if (model.SourceContainerId == 0) {
                routeValues.Remove("SourceContainerId");
            }
            else {
                routeValues["SourceContainerId"] = model.SourceContainerId;
            }
            routeValues["OrderBy"] = model.OrderBy;
            routeValues["TargetContainerId"] = model.TargetContainerId;

            return RedirectToAction("Choose", routeValues);
        }