Refactor FileRepository and InMemoryRepository