public function onBeforeWrite()
    {
        $fieldMap = json_decode($this->SpamFieldSettings, true);
        if (empty($fieldMap)) {
            $fieldMap = array();
        }

        foreach ($this->record as $key => $value) {
            if (substr($key, 0, 8) === 'spammap-') {
                $fieldMap[substr($key, 8)] = $value;
            }
        }
        $this->setField('SpamFieldSettings', json_encode($fieldMap));

        return parent::onBeforeWrite();
    }