Refactor abstract repository class