public function getMagentoStoreId()
    {
        if ($this->checkoutSession instanceof BackendSessionQuote) {
            $quote = $this->checkoutSession;
        } else {
            $quote = $this->checkoutSession->getQuote();
        }

        return (int) (($quote && $quote->getStoreId()) ?
            $quote->getStoreId() : 0);
    }