Pull out common logic out into base class, to allow for easier test case writing