Support faceting in entities and relations listings. 

@scott2b I was wondering whether you might have a second to review this; it turned out to be more of a mess than I expected. 

Potential extensions: 

- [ ] Status facets
- [ ] 'relations' facet that combines inbound and outbound.
I am concerned about the possibility that obj would be a non-generator iterable here. Could this happen. Would it be better to check if obj is iterable?

Also, I don't remember, does the JSONEncoder handle traversing the object automatically? Do we need to return encoded objects in the iterable, or does the encoding happen implicitly?