public function checkValuesUponSave()
    {
        foreach ($this->getJsonColumns() as $column_name) {
            if (isset($this->attributes[$column_name]) && !is_string($this->attributes[$column_name])) {
                if (is_array($this->attributes[$column_name])) {
                    $this->attributes[$column_name] = json_encode($this->attributes[$column_name]);
                } elseif (is_object($this->attributes[$column_name])) {
                    $this->attributes[$column_name] = (string) $this->attributes[$column_name];
                }
            }
        }
    }