public function setFormValues($data = null)
    {
        if ($data === null) {
            $data = $this->getSaveData();
        }

        /*
         * Fill the model as if it were to be saved
         */
        $this->prepareModelsToSave($this->model, $data);

        /*
         * Data set differs from model
         */
        if ($this->data !== $this->model) {
            $this->data = (object) array_merge((array) $this->data, (array) $data);
        }

        /*
         * Set field values from data source
         */
        foreach ($this->allFields as $field) {
            $field->value = $this->getFieldValue($field);
        }

        return $data;
    }