class ActiveFedora::Associations::CollectionAssociation

def replace(other_array)

This will perform a diff and delete/add only records that have changed.
Replace this collection with +other_array+
def replace(other_array)
  other_array.each { |val| raise_on_type_mismatch(val) }
  load_target
  other   = other_array.size < 100 ? other_array : other_array.to_set
  current = @target.size < 100 ? @target : @target.to_set
  delete(@target.select { |v| !other.include?(v) })
  concat(other_array.select { |v| !current.include?(v) })
end