private final SyncRfQ createSyncRfQ(final I_C_RfQResponseLine rfqResponseLine) {
    if (!pmmRfQBL.isDraft(rfqResponseLine)) {
      // shall not happen
      return null;
    }

    final SyncRfQ syncRfQ = new SyncRfQ();
    syncRfQ.setUuid(SyncUUIDs.toUUIDString(rfqResponseLine));

    syncRfQ.setDateStart(rfqResponseLine.getDateWorkStart());
    syncRfQ.setDateEnd(rfqResponseLine.getDateWorkComplete());
    syncRfQ.setDateClose(rfqResponseLine.getDateResponse());

    syncRfQ.setBpartner_uuid(SyncUUIDs.toUUIDString(rfqResponseLine.getC_BPartner()));

    final I_PMM_Product pmmProduct = rfqResponseLine.getPMM_Product();
    final SyncProduct syncProduct = createSyncProduct(pmmProduct);
    syncRfQ.setProduct(syncProduct);

    syncRfQ.setQtyRequested(rfqResponseLine.getQtyRequiered());
    syncRfQ.setQtyCUInfo(rfqResponseLine.getC_UOM().getUOMSymbol());

    syncRfQ.setCurrencyCode(rfqResponseLine.getC_Currency().getISO_Code());

    return syncRfQ;
  }
  private List<SyncProductSupply> createPlannedSyncProductSupplies(
      final I_C_RfQResponseLine rfqResponseLine) {
    final I_C_Flatrate_Term contract = rfqResponseLine.getC_Flatrate_Term();
    Check.assumeNotNull(contract, "contract not null");

    final List<I_C_RfQResponseLineQty> rfqResponseLineQtys =
        pmmRfQDAO.retrieveResponseLineQtys(rfqResponseLine);
    if (rfqResponseLineQtys.isEmpty()) {
      return ImmutableList.of();
    }

    final String bpartner_uuid = SyncUUIDs.toUUIDString(contract.getDropShip_BPartner());
    final String contractLine_uuid = SyncUUIDs.toUUIDString(contract);
    final String product_uuid = SyncUUIDs.toUUIDString(contract.getPMM_Product());

    final List<SyncProductSupply> plannedSyncProductSupplies =
        new ArrayList<>(rfqResponseLineQtys.size());
    for (final I_C_RfQResponseLineQty rfqResponseLineQty : rfqResponseLineQtys) {
      final SyncProductSupply syncProductSupply = new SyncProductSupply();
      syncProductSupply.setBpartner_uuid(bpartner_uuid);
      syncProductSupply.setContractLine_uuid(contractLine_uuid);
      syncProductSupply.setProduct_uuid(product_uuid);

      syncProductSupply.setDay(rfqResponseLineQty.getDatePromised());
      syncProductSupply.setQty(rfqResponseLineQty.getQtyPromised());
      plannedSyncProductSupplies.add(syncProductSupply);
    }

    return plannedSyncProductSupplies;
  }
  private Multimap<Integer, I_C_RfQResponseLine> getActiveRfqResponseLines_IndexedByBPartnerId() {
    if (_bpartnerId2activeRfqResponseLines_fullyLoadedRequired
        && !_bpartnerId2activeRfqResponseLines_fullyLoaded) {
      _bpartnerId2activeRfqResponseLines.clear(); // clear all first

      final List<I_C_RfQResponseLine> rfqResponseLines =
          pmmRfQDAO.retrieveAllActiveResponseLines(getCtx());
      for (final I_C_RfQResponseLine rfqResponseLine : rfqResponseLines) {
        final int bpartnerId = rfqResponseLine.getC_BPartner_ID();
        _bpartnerId2activeRfqResponseLines.put(bpartnerId, rfqResponseLine);
      }

      _bpartnerId2activeRfqResponseLines_fullyLoaded = true;
    }
    return _bpartnerId2activeRfqResponseLines;
  }
  public SyncRfQCloseEvent createSyncRfQCloseEvent(
      final I_C_RfQResponseLine rfqResponseLine, final boolean winnerKnown) {
    if (!pmmRfQBL.isCompletedOrClosed(rfqResponseLine)) {
      logger.warn(
          "Skip creating close event for {} because it's not completed or closed", rfqResponseLine);
      return null;
    }

    final SyncRfQCloseEvent event = new SyncRfQCloseEvent();
    event.setRfq_uuid(SyncUUIDs.toUUIDString(rfqResponseLine));
    event.setWinnerKnown(winnerKnown);
    if (winnerKnown) {
      event.setWinner(rfqResponseLine.isSelectedWinner());
    }

    if (winnerKnown && event.isWinner()) {
      final List<SyncProductSupply> plannedSyncProductSupplies =
          createPlannedSyncProductSupplies(rfqResponseLine);
      event.getPlannedSupplies().addAll(plannedSyncProductSupplies);
    }

    return event;
  }