refactor transaction callback into sql-helper