Some fixes and code clean up in PackageRepositories service.
Extended unit tests for PackageRepositories service.