/**
   * Writes XML elements.
   *
   * @param writer the writer
   * @throws Exception the exception
   */
  @Override
  protected void writeElementsToXml(EwsServiceXmlWriter writer) throws Exception {
    final String EnumDelimiter = ",";

    // Write UserConfiguationName element
    UserConfiguration.writeUserConfigurationNameToXml(
        writer, XmlNamespace.Messages, this.name, this.parentFolderId);

    // Write UserConfigurationProperties element
    writer.writeElementValue(
        XmlNamespace.Messages,
        XmlElementNames.UserConfigurationProperties,
        this.properties.toString().replace(EnumDelimiter, "").replace("[", "").replace("]", ""));
  }