protected function writeConfig(array $config, array $merge = []) {
    if ($merge) {
      $config = $this->merge($merge, $config);
    }

    $success = file_put_contents($this->configPath, Yaml::encode($config));

    if ($success === FALSE) {
      throw new \RuntimeException('Could not write ' . $this->configPath);
    }
  }