Don't add the same entity again

An entity can be contained in multiple groups at any time, but should
not be included multiple times as different results in a query.