persist and flush in one place