Refactoring repository classes