You could move this outside of the if statement (or extract a separate method).