protected function saveModelsDefinition(array $models_definition)
    {
        $file = $this->getModelsConfigFile();
        if (file_exists($file) && !is_writable($file)) {
            throw new Exception\ModelFileNotWritableException(__METHOD__ . "Model configuration file '$file' cannot be overwritten, not writable.");
        }

        //$config = new Config($models_defintion, true);
        $writer = new Writer\PhpArray();
        $models_definition['normalist'] = ['model_version' => Metadata\NormalistModels::VERSION];
        $writer->toFile($file, $models_definition, $exclusiveLock = true);
        $perms = $this->params['permissions'];
        if ($perms != '') {
            if (decoct(octdec($perms)) == $perms) {
                $perms = octdec($perms);
            }
            chmod($file, $perms);
        }
        return $this;
    }