private void removeFromStats(String subType) {
    if (sessionProvider == null) return;

    SessionDetails sessionDetails = sessionProvider.get();
    if (sessionDetails != null) {
      String userId = sessionDetails.userId();

      Map<String, SubscriptionStat> subStats = getSubscriptionMap();
      if (subStats != null) {
        SubscriptionStat stat = subStats.get(userId + "~" + subType);
        if (stat == null) {
          throw new AssertionError("There should be an active subscription");
        }
        stat.setActiveSubscriptions(stat.getActiveSubscriptions() - 1);
        stat.setRecentlySubscribed(LocalTime.now());
        subStats.put(userId + "~" + subType, stat);
      }
    }
  }
  private void addToStats(String subType) {
    if (sessionProvider == null) return;

    SessionDetails sessionDetails = sessionProvider.get();
    if (sessionDetails != null) {
      String userId = sessionDetails.userId();

      Map<String, SubscriptionStat> subStats = getSubscriptionMap();
      if (subStats != null) {
        SubscriptionStat stat = subStats.get(userId + "~" + subType);
        if (stat == null) {
          stat = new SubscriptionStat();
          stat.setFirstSubscribed(LocalTime.now());
        }
        stat.setTotalSubscriptions(stat.getTotalSubscriptions() + 1);
        stat.setActiveSubscriptions(stat.getActiveSubscriptions() + 1);
        stat.setRecentlySubscribed(LocalTime.now());
        subStats.put(userId + "~" + subType, stat);
      }
    }
  }