/**
  * Decorates a collection of entities as Nodes
  *
  * @param Traversable|array $input
  * @return Traversable|array
  */
 public function getNodes($input)
 {
     if ($input instanceof PersistentCollection) {
         // Return instance of ArrayCollection instead of PersistentCollection
         $hm = $this;
         return $input->unwrap()->map(function ($node) use($hm) {
             return $hm->getNode($node);
         });
     } elseif (is_array($input) || $input instanceof Traversable) {
         foreach ($input as $key => $entity) {
             $input[$key] = $this->getNode($entity);
         }
         return $input;
     }
     throw new \InvalidArgumentException('Input to getNodes should be a PersistentCollection or a ' . 'Traversable/array, ' . gettype($input) . ' provided.');
 }