added recursion to model gathering to support more than one level nesting of objects