Abstract repository refactoring