public void ListViewCategories_InsertItem()
 {
     var item = new Category();
     TryUpdateModel(item);
     if (ModelState.IsValid)
     {
         dbContext.Categories.Add(item);
         dbContext.SaveChanges();
     }
 }
 public void ListViewCategories_InsertItem()
 {
     var item = new Category();
     TryUpdateModel(item);
     if (ModelState.IsValid)
     {
         try
         {
             this.dbContext.Categories.Add(item);
             this.dbContext.SaveChanges();
         }
         catch (DbUpdateException ex)
         {
             this.LabelValidation.Text = string.Format("Category {0} already exists", item.Name);
         }
     }
 }