public function getSumOfShippedItemsByItemId($itemId, $includeStatusDeliveryNote)
    {
        try {
            $qb = $this->createQueryBuilder('shipping')
                ->select('sum(shippingItems.quantity) AS shipped')
                ->join('shipping.shippingItems', 'shippingItems')
                ->join('shippingItems.item', 'item', 'WITH', 'item.id = :itemId')
                ->join('shipping.status', 'status')
                ->groupBy('item.id')
                ->where('status.id = :statusId')
                ->setParameter('itemId', $itemId)
                ->setParameter('statusId', ShippingStatus::STATUS_SHIPPED);
            if ($includeStatusDeliveryNote) {
                $qb->orWhere('status.id = :statusId2')
                    ->setParameter('statusId2', ShippingStatus::STATUS_DELIVERY_NOTE);
            }
            return $qb->getQuery()->getSingleScalarResult();
        } catch (NoResultException $exc) {
            return null;
        }
    }