Define a factory method to create a repository with given contents