Cleaned up RepositoryManager interface.

Moved lots to test repository manager as not needed unless in test environment. Added a Repositories object that can be used to cache RepositoryManagers.