I'm not entirely sure that this is the right place for this check. Maybe mongo should be the one querying entities and attributes by valueID, but I couldn't find that functionality in the dark chambers of the mongo lib.

It's easy enough to put it here, though.