Support for models which reference themselves. Fixing a max recursion depth error