private function addTraversable(\Traversable $result)
    {
        /*
         * Since we only know, that $result is an instance of \Traversable
         * (and thus, usable in a foreach), we cannot relay on methods like first()
         * which are defined in the \Iterable interface.
         * We must use a foreach to get the first item.
         *
         * Because PHP does not unset the loop variable, this works.
         */
        foreach ($result as $item) {
            break;
        }

        /* @var null|object|mixed $item */
        if (!$item instanceof EntityInterface) {
            throw new \InvalidArgumentException('Traversable objects must be a non-empty collection of Entity instances.');
        }

        $name = get_class($item);

        return $this->addArray([
            'name' => $name,
            'entities' => $result,
        ]);
    }