public function beforeSave($event)
    {
        foreach ($this->attributes as $name) {
            if (!empty($this->owner->$name)) {
                $this->owner->$name = $this->jsonEncodeAttribute($name);
            } else {
                $this->owner->$name = null;
            }
        }
    }