public function update(array $data)
    {
        // setup the custom options
        foreach ($this->getCustomOptions() as $key => $value) {
            if (isset($data[$value]) && $data[$value] == 'custom' && $data[$value . '_custom'] != '') {
                $data['_form_' . $value] = $data[$value];
                $data[$value] = $data[$value . '_custom'];
            }
        }
        
        foreach ($data as $key => $value) {
            if (in_array($key, $this->getSerialized())) {
                $value = (is_array($value) ? serialize($value) : serialize(array(
                    $value
                )));
            }
            
            if (in_array($key, $this->getEncrypted()) && $value != '') {
                $value = $this->getEncrypt()->encode($value);
            }
            
            $this->updateSetting($key, $value);
        }
        
        return true;
    }