public function saveParams(array $parameters, $environment = "")
    {


        foreach ($parameters as $namespace => $section) {

            $_file = PATH_CONFIG . DS . strtolower($namespace) . ".ini";
            $_globals = "";

            foreach ($section as $key => $params) {

                if (!empty($params) && is_array($params)) {
                    // 2 loops to write `globals' on top, alternative: buffer
                    $_globals .= static::toIniString($params, $key);
                }
            }

            //Only save if the config file is not empty

            if (!empty($_globals)) {
                //check if we have a file;
                if (!$this->isFile($_file)) {
                    if (!$this->create($_file)) {
                        throw new \Exception("Could not create the configuration file {$_file}. Please check you have sufficient permission to do this");
                        return false;
                    }
                }

                //write to file
                if (!$this->write($_file, $_globals)) {
                    throw new \Exception(t("Could not write out to the configuration file"));
                    return false;
                }
            }
        }

        return true;
    }