public async Task <IActionResult> Index(ContentOptions options, PagerParameters pagerParameters)
        {
            if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageTenantFeatureProfiles))
            {
                return(Forbid());
            }

            var siteSettings = await _siteService.GetSiteSettingsAsync();

            var pager = new Pager(pagerParameters, siteSettings.PageSize);
            var featureProfilesDocument = await _featureProfilesManager.GetFeatureProfilesDocumentAsync();

            var featureProfiles = featureProfilesDocument.FeatureProfiles.ToList();

            if (!String.IsNullOrWhiteSpace(options.Search))
            {
                featureProfiles = featureProfiles.Where(x => x.Key.Contains(options.Search, StringComparison.OrdinalIgnoreCase)).ToList();
            }

            var count = featureProfiles.Count;

            featureProfiles = featureProfiles.OrderBy(x => x.Key)
                              .Skip(pager.GetStartIndex())
                              .Take(pager.PageSize).ToList();

            var pagerShape = (await New.Pager(pager)).TotalItemCount(count);

            var model = new FeatureProfilesIndexViewModel
            {
                FeatureProfiles = featureProfiles.Select(x => new FeatureProfileEntry {
                    Name = x.Key, FeatureProfile = x.Value
                }).ToList(),
                Options = options,
                Pager   = pagerShape
            };

            model.Options.ContentsBulkAction = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text = S["Delete"], Value = nameof(ContentsBulkAction.Remove)
                }
            };

            return(View("Index", model));
        }
        public async Task ProcessDeploymentStepAsync(DeploymentStep step, DeploymentPlanResult result)
        {
            if (!(step is AllFeatureProfilesDeploymentStep))
            {
                return;
            }

            var featureProfileObjects = new JObject();
            var featureProfiles       = await _featureProfilesManager.GetFeatureProfilesDocumentAsync();

            foreach (var featureProfile in featureProfiles.FeatureProfiles)
            {
                featureProfileObjects[featureProfile.Key] = JObject.FromObject(featureProfile.Value);
            }

            result.Steps.Add(new JObject(
                                 new JProperty("name", "FeatureProfiles"),
                                 new JProperty("FeatureProfiles", featureProfileObjects)
                                 ));
        }