LPS-46842 move all repository initialization code into the new factories

Hey Brian,

This is the first pull. There are more coming.