public ActionResult Add(CategoryModels model) { if (ModelState.IsValid) { try { var m = new ArticleCategory { Name = model.Name, Description = model.Description, DisplayOrder = model.DisplayOrder, IncludeInTopMenu = model.IncludeInTopMenu, ParentCategoryId = model.ParentCategoryId ?? 0, Published = model.Published, ShowOnHomePage = model.ShowOnHomePage, MetaDescription = model.MetaDescription, MetaKeywords = model.MetaKeywords, MetaTitle = model.MetaTitle, CreatedOnUtc = DateTime.Now, UpdatedOnUtc = DateTime.Now }; _articleCategoryService.Add(m); if (m.Id > 0) { return(View("Add", model)); } } catch (Exception ex) { logger.Error(ex); } //return RedirectToAction("Index", "Home"); } // If we got this far, something failed, redisplay form return(View(model)); }