public function removeOptionByValue($value)
    {
        // walk all options
        $options = $this->options;

        // Empty options;
        $this->options = [];

        foreach ($options as $option) {
            if ($option instanceof Option) {
                if ($option->getValue() != $value) {
                    $this->options[] = $option;
                }
            } else {
                if ($option instanceof Optgroup) {
                    $subOptions = [];
                    $options2 = $option->getOptions();
                    foreach ($options2 as $option2) {
                        if ($option2->getValue() != $value) {
                            $subOptions[] = $option2;
                        }
                    }

                    $option->setOptions($subOptions);

                    if (sizeof($subOptions) > 0) {
                        $this->options[] = $option;
                    }
                }
            }
        }

        return $this;
    }