#40481 some more refactoring to make repos and collections identical