public static function setOptions(HTMLFactoryInterface $factory, HTMLElement $select, $options = [], $checkedValue = null)
    {
        foreach ($options as $value => $title) {
            // Build option
            $option = $factory->buildHtmlElement('option', $title);
            $option->attr('value', $value);

            // Append option to container
            $factory->getHTMLHandler()->append($select, $option);
        }

        // Set checked values
        $checkedValues = is_array($checkedValue) ? $checkedValue : [$checkedValue];
        foreach ($checkedValues as $value) {
            $option = $select->select(sprintf('option[value=%s]', $value))->item(0);
            if ($option) {
                $factory->getHTMLHandler()->attr($option, 'selected', 'selected');
            }
        }
    }