refactoring repositories for remove compound indexes. Add versioning in documents.