private function save(OrderedItem $item, Shipment $shipment, $existingItem = false)
 {
     $validator = $this->createOrderedItemValidator();
     if ($validator->isValid()) {
         if ($count = (int) $this->request->get('count') && !(int) $this->request->get('downloadable')) {
             $item->count->set($count);
         }
         $shipment->loadItems();
         if (!$existingItem) {
             $shipment->addItem($item);
         }
         if ($shipment->getShippingService()) {
             $shipmentRates = $shipment->getDeliveryZone()->getShippingRates($shipment);
             $shipment->setAvailableRates($shipmentRates);
             $shipment->setRateId($shipment->getShippingService()->getID());
         }
         $shipment->recalculateAmounts();
         $shipment->save();
         return array('item' => array('ID' => $item->getID(), 'Product' => $item->getProduct()->toArray(), 'Shipment' => array('ID' => $shipment->getID(), 'amount' => (double) $shipment->amount->get(), 'shippingAmount' => (double) $shipment->shippingAmount->get(), 'taxAmount' => (double) $shipment->taxAmount->get(), 'total' => (double) $shipment->shippingAmount->get() + (double) $shipment->amount->get() + (double) $shipment->taxAmount->get(), 'prefix' => $shipment->getCurrency()->pricePrefix->get(), 'suffix' => $shipment->getCurrency()->priceSuffix->get(), 'Order' => $shipment->order->get()->toFlatArray()), 'count' => $item->count->get(), 'price' => $item->price->get(), 'priceCurrencyID' => $item->getCurrency()->getID(), 'isExisting' => $existingItem, 'variations' => $item->getProduct()->getParent()->getVariationData($this->application)));
     } else {
         return array('errors' => $validator->getErrorList());
         //return new JSONResponse(array('errors' => $validator->getErrorList()), 'failure', $this->translate('_unable_to_update_items_quantity'));
     }
 }