Reset ReferenceManagement changes

Change of strategy
Use package in LocalRepository if it already exists

Add some tests to some the code is still broken at this point...