public function isSelected($selected, $value, $i)
    {
        if (is_array($selected)) {
            foreach ($selected as $s) {
                if ($this->isSelected($s, $value, $i)) {
                    return true;
                }
            }
        } elseif (is_int($selected) && $i === $selected) {
            return true;
        } elseif ($value === $selected) {
            return true;
        }

        return false;
    }