public void removeContentReferences(
      Map<ContentVersionVO, RegistryVO> contentVersionRegistryPair,
      InfoGluePrincipal infoGluePrincipal,
      Database db)
      throws SystemException, Exception {
    ContentVersionVO contentVersionVO;
    RegistryVO registryVO;
    for (Map.Entry<ContentVersionVO, RegistryVO> pair : contentVersionRegistryPair.entrySet()) {
      contentVersionVO = pair.getKey();
      registryVO = pair.getValue();
      if (logger.isDebugEnabled()) {
        logger.debug(
            "About to clean ContentVersion "
                + contentVersionVO.getContentVersionId()
                + " for references to: "
                + registryVO.getEntityName()
                + "<"
                + registryVO.getEntityId()
                + ">");
      }
      String versionValue = contentVersionVO.getVersionValue();

      if (registryVO.getReferenceType().equals(RegistryVO.INLINE_LINK))
        versionValue = deleteInlineLinks(versionValue, new Integer(registryVO.getEntityId()), db);
      if (registryVO.getReferenceType().equals(RegistryVO.INLINE_ASSET))
        versionValue = deleteInlineAssets(versionValue, new Integer(registryVO.getEntityId()));
      if (registryVO.getReferenceType().equals(RegistryVO.INLINE_SITE_NODE_RELATION))
        versionValue =
            deleteInlineSiteNodeRelations(versionValue, new Integer(registryVO.getEntityId()));
      if (registryVO.getReferenceType().equals(RegistryVO.INLINE_CONTENT_RELATION))
        versionValue =
            deleteInlineContentRelations(versionValue, new Integer(registryVO.getEntityId()));

      contentVersionVO.setVersionModifier(infoGluePrincipal.getName());
      contentVersionVO.setModifiedDateTime(DateHelper.getSecondPreciseDate());
      contentVersionVO.setVersionValue(versionValue);

      // ContentVersionController.getContentVersionController().update(contentVersionVO.getContentId(), contentVersionVO.getLanguageId(), contentVersionVO, db);
      ContentVersionController.getContentVersionController()
          .update(
              contentVersionVO.getContentId(),
              contentVersionVO.getLanguageId(),
              contentVersionVO,
              infoGluePrincipal,
              true,
              db,
              true);
    }
  }