Refactoring the repositories to better support inheritance and other repositories