private Product Create(Product product)
 {
     using (var productContext = new ProductContext())
     {
         var result = productContext.Products.Add(product);
         productContext.SaveChanges();
         return productContext.Products.Add(result);
     }
 }
 private Product Update(Product product)
 {
     using (var productContext = new ProductContext())
     {
         productContext.Products.Attach(product);
         productContext.Entry(product).State = EntityState.Modified;
         productContext.SaveChanges();
         return product;
     }
 }
 public void Delete(Guid productId)
 {
     Product toDel = null;
     using (var productContext = new ProductContext())
     {
         toDel = productContext.Products.Include("ChildProducts").SingleOrDefault(p => p.Id == productId);
         if (toDel != null)
         {
             productContext.Products.Remove(toDel);
             productContext.SaveChanges();
         }
         else
         {
             throw new ArgumentException();
         }
     }
 }