added initial support for to_many links between documents. Introducing a...

... result class will allow us to refactor and clean up this logic as its currently quite messy