Move common logic to a base class