Extracted the save function from migrate() for file migrations