public function writeFile(array $diff_res)
    {
        $base = array();
        if (is_readable($this->defFile)) {
            $base = $this->loadFromFile();
        }
        $merged_data = $this->getMergedData($base, $diff_res);
        ksort($merged_data);
        $yaml = Yaml::dump(array_values($merged_data));
        if (@file_put_contents($this->defFile, $yaml) === false) {
            throw new SugarException("Unable to dump metadata file to {$this->defFile}.");
        }
    }