protected function is_unique($value) : bool {
        global $DB;
        $datafield = $this->datafield();
        $where = "fieldid = ? AND {$datafield} = ?";
        $params = [$this->get_field()->get('id'), $value];
        if ($this->get('id')) {
            $where .= ' AND id <> ?';
            $params[] = $this->get('id');
        }
        return !$DB->record_exists_select('customfield_data', $where, $params);
    }