public bool UpdateMaterial(Material instance)
        {
            try
            {
                Material material = Db.Materials.Find(instance.MaterialId);
                Type type = instance.GetType();

                foreach (var info in type.GetProperties())
                {
                    if (info.CanWrite)
                    {
                        var value = info.GetValue(instance);
                        if (value != null)
                        {
                            info.SetValue(material, value, null);
                        }
                    }
                }
                Db.SaveChanges();
                return true;
            }
            catch
            {
                return false;
            }
        }
 public bool CreateMaterial(Material instance)
 {
     try
     {
         if (instance.MaterialId != 0) return false;
         Db.Materials.Add(instance);
         Db.SaveChanges();
         return true;
     }
     catch
     {
         return false;
     }
 }