public ActionResult Add(CategoryViewModel category) { var app = new ServiceReference.ContractClient(); var model = new ServiceReference.Category { Id = category.Id, Name = category.Name, Description = category.Description, Level = category.Level, ParentId = category.ParentId, Enabled = category.Enabled }; if (category.ParentId == null) { category.ParentId = 0; } app.AddCategory(model); return(RedirectToAction("GetAll")); }