public function updateApiEntity(Order $apiOrder, $locale)
    {
        $items = $apiOrder->getItems();

        // perform price calucaltion
        $prices = $supplierItems = null;
        $totalPrice = $this->priceCalculator->calculate($items, $prices, $supplierItems);

        if ($supplierItems) {
            $supplierItems = array_values($supplierItems);
            // update media api entities
            $this->createMediaForSupplierItems($supplierItems, $locale);
            // set grouped items
            $apiOrder->setSupplierItems($supplierItems);
        }

        $this->createMediaForItems($items, $locale);

        // check if any price in cart has changed
        $hasChangedPrices = false;
        foreach ($items as $item) {
            if ($item->getPriceChange()) {
                $hasChangedPrices = true;
                break;
            }
        }
        $apiOrder->setHasChangedPrices($hasChangedPrices);

        // set total price
        $apiOrder->setTotalNetPrice($totalPrice);
    }