public function setValue($value)
    {
        $this->selected = $value;
        if ($this->hasChildren()) {
            foreach ($this->childNodes as $child) {
                if ($child instanceof Select\Option) {
                    if ($child->getValue() == $this->selected) {
                        $child->select();
                    } else {
                        $child->deselect();
                    }
                } else if ($child instanceof Select\Optgroup) {
                    $options = $child->getOptions();
                    foreach ($options as $option) {
                        if ($option->getValue() == $this->selected) {
                            $option->select();
                        } else {
                            $option->deselect();
                        }
                    }
                }
            }
        }
        return $this;
    }