{
    if (options != null)
    {
      Map<Object, Object> mergedOptions = new HashMap<Object, Object>(saveOptions);
      mergedOptions.putAll(options);
      ((XMLResource)resource).save(writer, mergedOptions);
    }
    else
    {
      ((XMLResource)resource).save(writer, saveOptions);
    }
  }