private void LoadFieldRecords(Database dc, string entityName, Type fieldType)
        {
            FieldTypeAttribute fieldTypeAttribute = fieldType.BaseType.GetCustomAttributes(typeof(FieldTypeAttribute), false).First() as FieldTypeAttribute;
            String             fieldTypeName      = fieldTypeAttribute.GetFieldTypeName();

            Fields.Where(x => x.FieldTypeName == fieldTypeName)
            .ToList()
            .ForEach(field =>
            {
                var repository = new FieldRepository {
                    BundleFieldId = field.Id, EntityId = Id
                };
                field.Records = repository.Load(dc, entityName, field.FieldTypeName);
            });
        }
        private void AddFieldRecords(Database dc, Type fieldType)
        {
            FieldTypeAttribute fieldTypeAttribute = fieldType.BaseType.GetCustomAttributes(typeof(FieldTypeAttribute), false).First() as FieldTypeAttribute;
            String             fieldTypeName      = fieldTypeAttribute.GetFieldTypeName();

            Fields.Where(x => x.FieldTypeName == fieldTypeName && x.Records != null)
            .ToList()
            .ForEach(field =>
            {
                field.Records.ForEach(data =>
                {
                    var repository = data.ToObject(fieldType);
                    dc.Add(repository);
                });
            });
        }
        private void ToBusinessObject(Database dc, Type fieldType, JObject businessObject)
        {
            LoadFieldsDefinition(dc);

            FieldTypeAttribute fieldTypeAttribute = fieldType.BaseType.GetCustomAttributes(typeof(FieldTypeAttribute), false).First() as FieldTypeAttribute;
            String             fieldTypeName      = fieldTypeAttribute.GetFieldTypeName();

            Fields.Where(x => x.FieldTypeName == fieldTypeName && x.Records != null)
            .ToList()
            .ForEach(field =>
            {
                var fieldInstance = Activator.CreateInstance(fieldType) as FieldRepository;
                var fieldValue    = fieldInstance.ToBusinessObject(field);
                businessObject.Add(field.Name.FirstCharacterToUpper(), fieldValue == null ? null : JToken.FromObject(fieldValue));
            });
        }
        private String GetFieldTypeName <TFieldRepository>()
        {
            FieldTypeAttribute fieldType = typeof(TFieldRepository).BaseType.GetCustomAttributes(typeof(FieldTypeAttribute), false).First() as FieldTypeAttribute;

            return(fieldType.GetFieldTypeName());
        }