@Override
  @Cached(cacheName = I_C_ConversionType_Default.Table_Name + "#by#Dimension")
  public I_C_ConversionType retrieveDefaultConversionType(
      @CacheCtx final Properties ctx, final int adClientId, final int adOrgId, final Date date) {
    // NOTE to developer: keep in sync with: getDefaultConversionType_ID database function

    Check.assumeNotNull(date, "date not null");
    final Date dateDay = TimeUtil.trunc(date, TimeUtil.TRUNC_DAY);

    return Services.get(IQueryBL.class)
        .createQueryBuilder(I_C_ConversionType_Default.class, ctx, ITrx.TRXNAME_None)
        .addOnlyActiveRecordsFilter()
        .addInArrayFilter(
            I_C_ConversionType_Default.COLUMN_AD_Client_ID,
            adClientId,
            Env.CTXVALUE_AD_Client_ID_System)
        .addInArrayFilter(
            I_C_ConversionType_Default.COLUMN_AD_Org_ID, adClientId, Env.CTXVALUE_AD_Org_ID_System)
        .addCompareFilter(
            I_C_ConversionType_Default.COLUMN_ValidFrom, Operator.LESS_OR_EQUAL, dateDay)
        //
        .orderBy()
        .addColumn(I_C_ConversionType_Default.COLUMN_ValidFrom, Direction.Descending, Nulls.Last)
        .addColumn(I_C_ConversionType_Default.COLUMN_AD_Client_ID, Direction.Descending, Nulls.Last)
        .addColumn(I_C_ConversionType_Default.COLUMN_AD_Org_ID, Direction.Descending, Nulls.Last)
        .endOrderBy()
        //
        .setLimit(1) // only the first one
        //
        .andCollect(I_C_ConversionType_Default.COLUMN_C_ConversionType_ID)
        .create()
        .firstOnlyNotNull(I_C_ConversionType.class);
  }
 /** @return the <code>model</code>'s date promised value, truncated to "day". */
 public Timestamp getDatePromised() {
   return TimeUtil.trunc(model.getDatePromised(), TimeUtil.TRUNC_DAY);
 }