code: public CmsXmlContentErrorHandler saveContent(Map<String, String> contentValues) throws CmsUgcException {
  
          checkNotFinished();
          try {
              CmsFile file = m_cms.readFile(m_editResource);
              CmsXmlContent content = addContentValues(file, contentValues);
              CmsXmlContentErrorHandler errorHandler = content.validate(m_cms);
              if (!errorHandler.hasErrors()) {
                  file.setContents(content.marshal());
                  // the file content might have been modified during the write operation
                  file = m_cms.writeFile(file);
              }
  
              return errorHandler;
          } catch (CmsException e) {
              LOG.error(e.getLocalizedMessage(), e);
              throw new CmsUgcException(e, CmsUgcConstants.ErrorCode.errMisc, e.getLocalizedMessage());
          }
  
      }
docs: Saves the content values to the sessions edit resource.<p>
  
  @param contentValues the content values by XPath
  
  @return the validation handler
  
  @throws CmsUgcException if writing the content fails