public function _serializeSaveField(Field $f, $value)
    {
        switch ($f->serialize === true ? 'serialize' : $f->serialize) {
        case 'serialize':
            return serialize($value);
        case 'json':
            return $this->jsonEncode($f, $value);
        case 'base64':
            if (!is_string($value)) {
                throw new Exception([
                    'Field value can not be base64 encoded because it is not of string type',
                    'field' => $f,
                    'value' => $value,
                ]);
            }

            return base64_encode($value);
        }
    }