Factor the check in a new method