protected function prepareModelsToSave($model, $saveData)
    {
        $this->modelsToSave = [];
        $this->setModelAttributes($model, $saveData);
        $this->modelsToSave = array_reverse($this->modelsToSave);
        return $this->modelsToSave;
    }
protected function prepareModelsToSave($model, $saveData)
    {
        $this->modelsToSave = [];
        $this->setModelAttributes($model, $saveData);
        $this->modelsToSave = array_reverse($this->modelsToSave);
        return $this->modelsToSave;
    }
protected function prepareModelsToSave ( $ model , $ saveData ) { $ this -> modelsToSave = [ ] ; $ this -> setModelAttributes ( $ model , $ saveData ) ; $ this -> modelsToSave = array_reverse ( $ this -> modelsToSave ) ; return $ this -> modelsToSave ; }
Takes a model and fills it with data from a multidimensional array.
If an attribute is found to be a relationship, that relationship
is also filled.

$modelsToSave = $this->prepareModelsToSave($model, [...]);

foreach ($modelsToSave as $modelToSave) {
$modelToSave->save();
}

@param \October\Rain\Database\Model $model Model to fill.
@param array $saveData Attribute values to fill model.
@return array The collection of models to save.
Takes a model and fills it with data from a multidimensional array . If an attribute is found to be a relationship that relationship is also filled .