public IActionResult Create(ItemCategory obj) { var existingCategory = _itemCategoryRepository.GetItemCategoryByName(obj.CategoryName); if (ModelState.IsValid && existingCategory == null) { _itemCategoryRepository.CreateAddItemCategory(obj); return(RedirectToAction("Index")); } return(View(obj)); }