Pull that `if ...` out into a separate method.