public async Task <IActionResult> View([FromRoute] Guid applicationId, [FromQuery] Guid?environmentId = null, [FromQuery] string search = null)
        {
            ViewData["ApplicationId"] = applicationId;

            var environments = await environmentService.GetEnvironments(applicationId);

            ApplicationEnvironment selectedEnvironment = environments.FirstOrDefault(x => x.Id == environmentId);

            if (selectedEnvironment == null)
            {
                selectedEnvironment = environments.First(x => x.IsDefault);
            }

            var featureToggles = await featureToggleService.GetKeyValues(selectedEnvironment.Id);

            if (!string.IsNullOrEmpty(search))
            {
                featureToggles     = featureToggles.Where(f => f.Key.ToLower().Contains(search.ToLower()));
                ViewData["Search"] = search;
            }

            var model = new FeatureToggleViewModel
            {
                Environments = environments.Select(x => new ApplicationEnvironmentModel {
                    Name = x.Name, EnvironmentId = x.Id, ApplicationId = x.ApplicationId
                }),
                FeatureToggles = featureToggles.Select(x => new ApplicationFeatureToggleModel {
                    Id = x.SettingId, Key = x.Key, IsEnabled = x.IsEnabled, LastModifiedAt = x.LastModifiedAt
                }).OrderBy(x => x.Key),
                SelectedEnvironment = new ApplicationEnvironmentModel {
                    ApplicationId = applicationId, EnvironmentId = selectedEnvironment.Id, Name = selectedEnvironment.Name
                }
            };

            return(View(model));
        }