Detect circular references in dicts used to populate models

Raise a helpful error rather than allowing a nasty stack overflow.

@nrschultz