public bool UpdateComponent(Component component)
 {
     //
     Builder.Data.ComponentBuilder cb = new Builder.Data.ComponentBuilder(this.Connection);
     if (cb.UpdateComponent(component.ID, component.Name, (int)component.Type, component.Title, component.Category,
                            Newtonsoft.Json.JsonConvert.SerializeObject(component.Keys), component.EntityKey))
     {
         foreach (Attribute att in component.Attributes)
         {
             if (att.ID != "")
             {
                 cb.UpdateComponentAttribute(component.ID, att.ID, att.DisplayName, att.IsRequired, att.IsUnique, att.IsCore,
                                             false, att.IsSecured,
                                             Convert.ToInt32(att.LookupInstanceID), (int)att.Type, att.Length, att.DefaultValue, att.FileExtension, att.ComponentLookup,
                                             att.ComponentLookupDisplayField
                                             );
             }
             else
             {
                 cb.SaveAttribute(att.Name, att.DisplayName, att.ComponentID, att.IsRequired, att.IsUnique, att.IsCore, false,
                                  att.IsSecured, Convert.ToInt32(att.LookupInstanceID), (int)att.Type, att.Length, att.DefaultValue,
                                  att.FileExtension, att.IsNullable, att.IsKey, att.IsAuto, att.ComponentLookup, att.ComponentLookupDisplayField);
             }
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public bool SaveComponent(Component component)
 {
     Builder.Data.ComponentBuilder cb = new Builder.Data.ComponentBuilder(this.Connection);
     component.ID = cb.SaveComponent(component.Name, "", Convert.ToInt32(component.Type), component.Name,
                                     Newtonsoft.Json.JsonConvert.SerializeObject(component.Keys), 1, component.TableName, component.EntityKey);
     foreach (Attribute att in component.Attributes)
     {
         att.ComponentID = component.ID;
         if (att.LookupInstanceID == "")
         {
             att.LookupInstanceID = "0";
         }
         att.ID = cb.SaveAttribute(att.Name, att.DisplayName, att.ComponentID, att.IsRequired,
                                   att.IsUnique, att.IsCore, false, att.IsSecured, Convert.ToInt32(att.LookupInstanceID), Convert.ToInt32(att.Type), att.Length, att.DefaultValue, att.FileExtension, att.IsNullable,
                                   att.IsKey, att.IsAuto, att.ComponentLookup, att.ComponentLookupDisplayField);
     }
     return(true);
 }