Add before_commit callback.