Added support for objects with references for fields, and unit test for it.