Refactoring of repository example