def create_iteration(identity, attribute_changes, start=nil, options={})
      start = effective_date(start || Date.today)
      transaction do
        current_record = find_by_identity(identity)
        if !current_record && options[:unterminate]
          current_record = latest_of(identity) # terminated.where(IDENTITY_COLUMN=>identity).first
          #   where(IDENTITY_COLUMN=>identity).where("#{effective_to_column_sql} < #{END_OF_TIME}").reorder("#{effective_to_column_sql} desc").limit(1).first
        end
        attributes = {IDENTITY_COLUMN=>identity}.with_indifferent_access
        if current_record
          non_replicated_attrs = %w[id effective_from effective_to updated_at created_at]
          attributes = attributes.merge current_record.attributes.with_indifferent_access.except(*non_replicated_attrs)
        end
        start = START_OF_TIME if options[:extend_from] && !identity_exists?(identity)
        attributes = attributes.merge(START_COLUMN=>start).merge(attribute_changes.with_indifferent_access.except(START_COLUMN, END_COLUMN))
        new_record = create(attributes)
        if new_record.errors.blank? && current_record
          # current_record.update_attributes END_COLUMN=>start
          current_record.send :"#{END_COLUMN}=", start
          current_record.save validate: false
        end
        new_record
      end
    end
def create_iteration(identity, attribute_changes, start=nil, options={})
      start = effective_date(start || Date.today)
      transaction do
        current_record = find_by_identity(identity)
        if !current_record && options[:unterminate]
          current_record = latest_of(identity) # terminated.where(IDENTITY_COLUMN=>identity).first
          #   where(IDENTITY_COLUMN=>identity).where("#{effective_to_column_sql} < #{END_OF_TIME}").reorder("#{effective_to_column_sql} desc").limit(1).first
        end
        attributes = {IDENTITY_COLUMN=>identity}.with_indifferent_access
        if current_record
          non_replicated_attrs = %w[id effective_from effective_to updated_at created_at]
          attributes = attributes.merge current_record.attributes.with_indifferent_access.except(*non_replicated_attrs)
        end
        start = START_OF_TIME if options[:extend_from] && !identity_exists?(identity)
        attributes = attributes.merge(START_COLUMN=>start).merge(attribute_changes.with_indifferent_access.except(START_COLUMN, END_COLUMN))
        new_record = create(attributes)
        if new_record.errors.blank? && current_record
          # current_record.update_attributes END_COLUMN=>start
          current_record.send :"#{END_COLUMN}=", start
          current_record.save validate: false
        end
        new_record
      end
    end
Create a new iteration
 options
 :unterminate - if the identity exists and is terminated, unterminate it (extending the last iteration to the new date)
 :extend_from - if no prior iteration exists, extend effective_from to the start-of-time
 (TODO: consider making :extend_from the default, adding an option for the opposite...)