private void updateCustomerStatusOf(
     final Optional<Draft> customerDraftOptional,
     final Optional<Draft> agreementDraftOptional,
     final Draft serviceDraft,
     final Handle handle) {
   final Map<String, Object> customerUpdate = Maps.newHashMap();
   final long customerId;
   final Service service = new Service(serviceDraft);
   if (customerDraftOptional.isPresent() && agreementDraftOptional.isPresent()) {
     customerId = customerDraftOptional.get().entityId();
     final Draft agreementDraft = agreementDraftOptional.get();
     final Agreement agreement = new Agreement(agreementDraft);
     if ("PL".equals(agreementDraft.entitySpate())) {
       final Object symbol = "PL-" + (agreementDraft.entityId() - 200000);
       customerUpdate.put("symbol", symbol);
     }
     final Object variable = agreement.number();
     customerUpdate.put("lastly_billed", service.periodStart().dayOfMonth().withMaximumValue());
     customerUpdate.put("status", 20);
     customerUpdate.put("variable", variable);
   } else {
     customerId = service.customerId();
   }
   customerUpdate.put("customer_status", "ACTIVE");
   customerUpdate.put("is_active", true);
   updateRecord(CUSTOMERS_TABLE, customerId, customerUpdate, handle);
 }
 private void insertAgreementOf(final Draft draft, final Handle handle) {
   log.debug("adding new agreement '{}' from draft '{}'", draft.entityId(), draft.id().value());
   final Agreement agreement = new Agreement(draft);
   insertRecordWithoutKey(AGREEMENTS_TABLE, agreement.record(), handle);
 }