public function createNode($parentKey, $key, $label, $value, $count, $selected)
    {
        /** @var $parentNode Node|null */
        $parentNode = isset($this->nodesByKey[$parentKey]) ? $this->nodesByKey[$parentKey] : null;
        $node = new Node($this, $parentNode, $key, $label, $value, $count, $selected);
        $this->nodesByKey[$key] = $node;

        if ($parentNode === null) {
            $this->addChildNode($node);
        } else {
            $parentNode->addChildNode($node);
        }

        $this->allNodes->add($node);
    }