public bool Bind()
        {
            if (response.RowSets.Length == 0)
            {
                return(false);
            }

            RowSet rowSet = response.RowSets[0];

            foreach (Row row in rowSet.Rows)
            {
                AmplaRecord model = new AmplaRecord(Convert.ToInt32(row.id))
                {
                    Module    = modelProperties.Module.ToString(),
                    ModelName = modelProperties.GetModelName()
                };

                foreach (var column in rowSet.Columns)
                {
                    model.AddColumn(column.displayName, DataTypeHelper.GetDataType(column.type));
                }

                foreach (XmlElement cell in row.Any)
                {
                    string field = XmlConvert.DecodeName(cell.Name);
                    string value = cell.InnerText;
                    model.SetValue(field, value);
                }

                model.SetMappedProperties(amplaViewProperties.GetFieldMappings());
                records.Add(model);
            }
            return(true);
        }
        public bool Bind()
        {
            versions.ModelName = modelProperties.GetModelName();

            AmplaRecordHistory <TModel> history       = new AmplaRecordHistory <TModel>(amplaRecord, auditRecord, viewProperties);
            List <AmplaRecordChanges>   recordChanges = history.Reconstruct();

            ModelVersion <TModel>[] modelVersions = new ModelVersion <TModel> [recordChanges.Count];

            TModel clonedModel = modelProperties.CloneModel(currentModel);

            for (int i = 0; i < modelVersions.Length; i++)
            {
                AmplaRecordChanges recordChange = recordChanges[i];
                bool isCurrent = i == (modelVersions.Length - 1);
                modelVersions[i] = new ModelVersion <TModel>(isCurrent, clonedModel)
                {
                    Version     = i + 1,
                    User        = recordChange.User,
                    VersionDate = recordChange.VersionDateTime,
                    Display     = recordChange.Display
                };
            }

            TModel current = currentModel;

            for (int i = modelVersions.Length - 1; i >= 0; i--)
            {
                var modelVersion = modelVersions[i];
                modelVersion.Model = modelProperties.CloneModel(current);
                AmplaRecordChanges recordChange = recordChanges[i];

                foreach (var field in recordChange.Changes)
                {
                    viewProperties.UpdateModel(current, field.Name, field.OriginalValue, false);
                }
                if (i == 0)
                {
                    modelVersion.Model = modelProperties.CloneModel(current);
                }
            }

            foreach (var modelVersion in modelVersions)
            {
                versions.Versions.Add(modelVersion);
            }
            return(true);
        }