I think this should be more generic, something like `is_array($value) || $value instanceof Traversable` The challenge is to know if there are entities, but it could be done by iterating right away and checking on each step