public function set($key, $value)
    {
        if (empty($key)) {
            throw new Exception("Key must be set");
        }

        $parts = array_reverse(explode(".", $key));
        $file = array_pop($parts);

        // we'll try to load a configuration file (if exists)
        if (!isset($this->registry[$file])) {
            $this->registry[$file] = $this->discover($file);
        }

        foreach ($parts as $part) {
            $value = array($part => $value);
        }

        if (is_array($this->registry[$file]) && (is_array($value))) {
            $this->registry[$file] = array_replace_recursive($this->registry[$file], $value);
        } else {
            $this->registry[$file] = $value;
        }
    }