Brought out the migration logic to a helper func.