DATAMONGO-348 - Add support for lazy loading of DbRefs.

Restructured the code according to code review.