Introduce BaseApi class to remove duplication