Correct way to create object InMemoryRepository