refactored RepositoryFactory class