replace_records function

Replace records