private void AddEntityInsertStatement(IChild child, EntityInfo childInfo, DateTime timeStamp)
        {
            var builder   = new ComplexCommandBuilder();
            var statement = new InsertStatement(childInfo.Name);

            foreach (var element in childInfo.Elements)
            {
                var value     = element.Name == "TimeStamp" ? timeStamp : element.GetValue(child);
                var parameter = value.ToParameter();
                statement.Add(element.Name, parameter.Name);

                builder.AddParameter(parameter);
            }

            foreach (var dataType in childInfo.DataTypes)
            {
                foreach (var element in dataType.Elements)
                {
                    var value     = dataType.GetValue(element, child);
                    var parameter = value.ToParameter();
                    statement.Add(element.Name, parameter.Name);
                    builder.AddParameter(parameter);
                }
            }

            builder.AddStatement(statement);
            Add(builder);

            AddSaveStatements(child, childInfo, timeStamp);

            child.Save(timeStamp);
        }
        private void AddEntityUpdateStatement(IChild child, EntityInfo childInfo, DateTime timeStamp)
        {
            var builder = new ComplexCommandBuilder();

            var idParameter = child.Id.ToParameter();

            builder.AddParameter(idParameter);
            var whereClause = string.Format("{0}.{1} = {2}", childInfo.Name, childInfo.Identifier.Name, idParameter.Name);
            var statement   = new UpdateStatement(childInfo.Name, whereClause);

            var timeStampParameter = timeStamp.ToParameter();

            statement.Set(childInfo.TimeStamp.Name, timeStampParameter.Name);
            builder.AddParameter(timeStampParameter);

            foreach (var element in childInfo.Elements.Where(x => !x.IsReadOnly))
            {
                var value     = element.GetValue(child);
                var parameter = value.ToParameter();
                statement.Set(element.Name, parameter.Name);
                builder.AddParameter(parameter);
            }

            foreach (var dataType in childInfo.DataTypes)
            {
                foreach (var element in dataType.Elements)
                {
                    var value     = dataType.GetValue(element, child);
                    var parameter = value.ToParameter();
                    statement.Set(element.Name, parameter.Name);
                    builder.AddParameter(parameter);
                }
            }

            builder.AddStatement(statement);
            Add(builder);

            AddSaveStatements(child, childInfo, timeStamp);

            child.Save(timeStamp);
        }