/**
  * @param HasNodeInterface|Node|null $parent
  * @param array                      $options
  *
  * @return Branch
  */
 public function getChildren($parent = null, array $options = [])
 {
     if ($parent instanceof HasNodeInterface) {
         $node = $this->publicNodeVersions->getNodeFor($parent);
     } elseif ($parent instanceof Category) {
         $node = $this->nodeRepository->find($parent->getNodeId());
     } elseif ($parent instanceof Node) {
         $node = $parent;
     } else {
         $node = null;
     }
     return $this->getNodeChildren(['parent' => $node] + $options);
 }
 /**
  * @param mixed $value
  * @return int
  */
 public function resolve($value)
 {
     if (is_int($value) || is_string($value)) {
         return (int) $value;
     }
     if ($value instanceof Category) {
         return $value->getNodeId();
     }
     if ($value instanceof Result) {
         return $value->get('node_id');
     }
     if ($value instanceof Node) {
         return $value->getId();
     }
     if ($value instanceof NodeTranslation) {
         return $value->getNode()->getId();
     }
     if ($value instanceof HasNodeInterface) {
         return $this->nodeVersions->getNodeFor($value)->getId();
     }
     throw new \InvalidArgumentException();
 }