public function saveSettings()
    {
        $old_dirty_state = $this->temp_settings["__dirty"];
        unset($this->temp_settings["__dirty"]);
        
        try {
            $this->saveXML($this->temp_settings);
            $this->settings = $this->temp_settings;
            return true;
        } catch (\Exception $ex) {
            $this->temp_settings["__dirty"] = $old_dirty_state;
            throw new \Exception($ex->getMessage(), $ex->getErrorCode());
        }
    }