Using after_flush instead of after_commit