Extract duplicate checks into a static method