@Override
 public DateTime getNextBillingDate(final UUID accountId, final InternalTenantContext context) {
   final List<SubscriptionBaseBundle> bundles = getBundlesForAccount(accountId, context);
   DateTime result = null;
   for (final SubscriptionBaseBundle bundle : bundles) {
     final List<SubscriptionBase> subscriptions =
         getSubscriptionsForBundle(bundle.getId(), context);
     for (final SubscriptionBase subscription : subscriptions) {
       final DateTime chargedThruDate = subscription.getChargedThroughDate();
       if (result == null || (chargedThruDate != null && chargedThruDate.isBefore(result))) {
         result = subscription.getChargedThroughDate();
       }
     }
   }
   return result;
 }
 public static SubscriptionBaseBundle getActiveBundleForKeyNotException(
     final List<SubscriptionBaseBundle> existingBundles,
     final SubscriptionDao dao,
     final Clock clock,
     final InternalTenantContext context) {
   for (SubscriptionBaseBundle cur : existingBundles) {
     final List<SubscriptionBase> subscriptions = dao.getSubscriptions(cur.getId(), context);
     for (SubscriptionBase s : subscriptions) {
       if (s.getCategory() == ProductCategory.ADD_ON) {
         continue;
       }
       if (s.getEndDate() == null || s.getEndDate().compareTo(clock.getUTCNow()) > 0) {
         return cur;
       }
     }
   }
   return null;
 }