public ActionResult Create(FilterFormViewModel model) { var availableFilters = _filterManager.GetFilterProperties(); if (ModelState.IsValid) { if (_filterManager.CheckFilterNameAvailability(model.FilterName, model.Id)) { var availableFilter = availableFilters.FirstOrDefault(f => f.FilteringName == model.SelectedFilter); if (availableFilter != null) { var filter = new Core.Entities.Filter() { FilteringName = availableFilter.FilteringName, Name = model.FilterName, TableName = availableFilter.TableName, ColumnName = availableFilter.ColumnName, CreatedBy = User.Identity.Name, UpdatedBy = User.Identity.Name }; _filterManager.Save(filter); return(RedirectToAction("Index")); } } } model.Filters = availableFilters; return(View(model)); }