public void removingSubscription(
      Subscription subscription, String presRulesAUID, String presRulesDocumentName) {

    if (logger.isDebugEnabled()) {
      logger.debug("removingSubscription(" + subscription + ")");
    }
    // get combined rules cmp
    Map combinedRules = sbb.getCombinedRules();
    if (combinedRules != null) {
      // remove subscription from map
      if (logger.isDebugEnabled()) {
        logger.debug("combined rules: " + combinedRules.keySet());
      }
      PresRuleCMPKey cmpKey =
          new PresRuleCMPKey(
              subscription.getSubscriber(),
              subscription.getNotifier(),
              subscription.getKey().getEventPackage(),
              subscription.getKey().getRealEventId());
      if (combinedRules.remove(cmpKey) != null) {
        if (logger.isDebugEnabled()) {
          logger.debug("removed rule from combined rules map (" + subscription + ")");
        }
        // check if subscription to pres-rules still needed
        boolean subscriptionNeeded = false;
        for (Object k : combinedRules.keySet()) {
          PresRuleCMPKey presRuleCMPKey = (PresRuleCMPKey) k;
          if (presRuleCMPKey.getNotifierWithoutParams().equals(cmpKey.getNotifierWithoutParams())
              && presRuleCMPKey.getEventPackage().equals(subscription.getKey().getEventPackage())) {
            if (logger.isDebugEnabled()) {
              logger.debug("subscription needed due to rule " + presRuleCMPKey);
            }
            subscriptionNeeded = true;
            break;
          }
        }
        if (!subscriptionNeeded) {
          if (logger.isDebugEnabled()) {
            logger.debug("subscription not needed");
          }
          DocumentSelector documentSelector =
              getDocumentSelector(
                  cmpKey.getNotifierWithoutParams(), presRulesAUID, presRulesDocumentName);
          sbb.getXDMClientControlSbb().unsubscribeDocument(documentSelector);
        }
      }
    }
  }
  public Request setNotifyContent(
      Subscription subscription,
      Request notify,
      Object content,
      ContentTypeHeader contentTypeHeader,
      ImplementedSubscriptionControlSbbLocalObject childSbb)
      throws JAXBException, ParseException, IOException {

    if (!subscription.getResourceList()) {
      // filter content per subscriber (notifier rules)
      Object filteredContent =
          childSbb.filterContentPerSubscriber(
              subscription.getSubscriber(),
              subscription.getNotifier(),
              subscription.getKey().getEventPackage(),
              content);
      // filter content per notifier (subscriber rules)
      // TODO
      // marshall content to string
      StringWriter stringWriter = new StringWriter();
      childSbb.getMarshaller().marshal(filteredContent, stringWriter);
      notify.setContent(stringWriter.toString(), contentTypeHeader);
      stringWriter.close();
    } else {
      // resource list subscription, no filtering
      if (content instanceof JAXBElement) {
        // marshall content to string
        StringWriter stringWriter = new StringWriter();
        childSbb.getMarshaller().marshal(content, stringWriter);
        notify.setContent(stringWriter.toString(), contentTypeHeader);
        stringWriter.close();
      } else {
        notify.setContent(content, contentTypeHeader);
      }
    }
    return notify;
  }