reducing duplicate logic in migrate and rollback calls