@Override public Entitlement doOperation(final CallContext ctx) throws InterruptedException, TimeoutException, EntitlementApiException { final PlanPhaseSpecifier spec = new PlanPhaseSpecifier(entitlement.getProductName(), ProductCategory.valueOf(entitlement.getProductCategory()), BillingPeriod.valueOf(entitlement.getBillingPeriod()), entitlement.getPriceList(), null); final UUID accountId = entitlement.getAccountId() != null ? UUID.fromString(entitlement.getAccountId()) : null; final LocalDate inputLocalDate = toLocalDate(accountId, requestedDate, callContext); final UUID bundleId = entitlement.getBundleId() != null ? UUID.fromString(entitlement.getBundleId()) : null; return (entitlement.getProductCategory().equals(ProductCategory.ADD_ON.toString())) ? entitlementApi.addEntitlement(bundleId, spec, inputLocalDate, callContext) : entitlementApi.createBaseEntitlement(accountId, spec, entitlement.getExternalKey(), inputLocalDate, callContext); }