protected function save(array $parameters, $foreignId, $namespace = null)
    {

        if (empty($parameters)) {
            return true;
        }
        $where = ['user_id' => $this->userId, 'foreign_id' => $foreignId, 'namespace' => $namespace];

        foreach ($parameters as $fieldId => $fieldValue) {
            array_set($where, 'field_id', $fieldId);

            if ($this->isTabular($fieldValue)) {
                foreach ($fieldValue as $optionId) {
                    array_set($where, 'option_id', $optionId);
                    $model = $this->resolveModel($where);
                    $model->save();
                }
            } else {
                $model       = $this->resolveModel($where);
                $model->data = $fieldValue;
                $model->save();
            }
        }
    }