public function RemoveInvalidItems()
    {
        // since this is a tcmsrecord list, we need to collect all valid ids, and the reload the list with them
        $oBasket = TShopBasket::GetInstance();
        $aValidIds = array();
        $this->GoToStart();
        $aValidShippingGroupItems = array();
        while ($oItem = &$this->Next()) {
            $oBasket->ResetAllShippingMarkers(); // we need to reset the shipping marker on every group call - since we want
            // to consider every single item in the basket

            if ($oItem->isAvailableIgnoreGroupRestriction()) {
                $aValidIds[] = MySqlLegacySupport::getInstance()->real_escape_string($oItem->id);
                $aValidShippingGroupItems['x'.$oItem->id] = $oItem;
            }
        }
        $oBasket->ResetAllShippingMarkers(); // once we are done, we want to clear the marker again

        // remove any shipping groups that are not allowed to be shown when other shipping groups are available
        $aRealValidIds = array();
        foreach ($aValidIds as $sShippingGroupId) {
            /** @var $oItem TdbShopShippingGroup */
            $oItem = $aValidShippingGroupItems['x'.$sShippingGroupId];
            if ($oItem->allowedForShippingGroupList($aValidIds)) {
                $aRealValidIds[] = $sShippingGroupId;
            }
        }
        $aValidIds = $aRealValidIds;
        unset($aRealValidIds);

        $query = 'SELECT `shop_shipping_group`.*
                  FROM `shop_shipping_group`
                 WHERE ';
        if (count($aValidIds) > 0) {
            $query .= " `shop_shipping_group`.`id` IN ('".implode("','", $aValidIds)."') ";
        } else {
            $query .= ' 1 = 0 ';
        }
        $query .= ' ORDER BY `shop_shipping_group`.`position`';
        $this->Load($query);
    }