Moves temporary fix to the test case setup.
Pass in the cursor for future transactional support.
Refactors module insertion code into reusable pieces.
Adds tree insertion from a dictionary based tree.
Adds collection insertion for metadata and trees.