private static BaseCustomFieldValue createCustomFieldSapProduct(String sapProduct) {
    if (sapProduct == null) {
      return null;
    }

    final DropDownCustomFieldValue customFieldValue = new DropDownCustomFieldValue();
    customFieldValue.setCustomFieldId(remoteConfig.getDfpCustomfieldIdForSapProduct());
    customFieldValue.setCustomFieldOptionId(
        remoteConfig.getDfpCustomfieldOptionsForSapProduct().get(sapProduct));

    return customFieldValue;
  }
  public static void updateSapProduct(LineItemDomain item, String newSapProduct) throws Exception {
    if (Objects.equals(item.getSapProduct(), newSapProduct)) {
      return;
    }

    final LineItemServiceInterface itemService =
        dfpServiceFactory.newDfpService(LineItemServiceInterface.class);

    LineItem dfpItem = itemService.getLineItem(item.getId());

    if (newSapProduct == null) {
      final List<BaseCustomFieldValue> fieldValues = new ArrayList<>();
      for (BaseCustomFieldValue fieldValue : dfpItem.getCustomFieldValues()) {
        if (!Objects.equals(
            fieldValue.getCustomFieldId(), remoteConfig.getDfpCustomfieldIdForSapProduct())) {
          fieldValues.add(fieldValue);
        }
      }
      dfpItem.setCustomFieldValues(fieldValues.toArray(new BaseCustomFieldValue[0]));
    } else {
      for (BaseCustomFieldValue fieldValue : dfpItem.getCustomFieldValues()) {
        if (Objects.equals(
            fieldValue.getCustomFieldId(), remoteConfig.getDfpCustomfieldIdForSapProduct())) {
          ((DropDownCustomFieldValue) fieldValue)
              .setCustomFieldOptionId(
                  remoteConfig.getDfpCustomfieldOptionsForSapProduct().get(newSapProduct));
        }
      }
    }

    itemService.updateLineItem(dfpItem);

    item.setSapProduct(newSapProduct);
  }