protected Plan getPlanFromInvoiceItem(final InvoiceItem invoiceItem, final TenantContext context)
     throws AnalyticsRefreshException {
   try {
     final Catalog catalog = getCatalog(context);
     return catalog.findPlan(
         invoiceItem.getPlanName(), invoiceItem.getStartDate().toDateTimeAtStartOfDay());
   } catch (CatalogApiException e) {
     logService.log(
         LogService.LOG_INFO,
         "Unable to retrieve plan for invoice item " + invoiceItem.getId(),
         e);
     return null;
   }
 }
 protected PlanPhase getPlanPhaseFromInvoiceItem(
     final InvoiceItem invoiceItem,
     final LocalDate subscriptionStartDate,
     final TenantContext context)
     throws AnalyticsRefreshException {
   try {
     final Catalog catalog = getCatalog(context);
     // TODO - Inaccurate timing
     return catalog.findPhase(
         invoiceItem.getPhaseName(),
         invoiceItem.getStartDate().toDateTimeAtStartOfDay(),
         subscriptionStartDate.toDateTimeAtStartOfDay());
   } catch (CatalogApiException e) {
     logService.log(
         LogService.LOG_INFO,
         "Unable to retrieve phase for invoice item " + invoiceItem.getId(),
         e);
     return null;
   }
 }