Change RepositoryDelegate into a factory function.