private function updateOrderStatus()
    {
        $this->_library->setEnvironment();
        $this->_library->setCharset();
        $this->_library->setLog();
        $transaction = $this->getTransaction();
        $order = $this->_order->get(
            $this->_helperData->getReferenceDecryptOrderID(
                $transaction->getReference()
            )
        );

        $status = $this->_helperData->getStatusFromKey(
            $transaction->getStatus()
        );

        if (!$this->compareStatus($status, $order->getStatus())) {
            $history = array (
                'status' => $this->_history->setStatus($status),
                'comment' => $this->_history->setComment('PagSeguro Notification')
            );
            $transactionCode = $transaction->getCode();
            $orderId = $order->getId();

            $order->setStatus($status);
            $order->setStatusHistories($history);
            $order->save();
            
            $this->updateSalesOrderGridTransactionCode($orderId, $transactionCode);
            $this->updatePagSeguroOrdersTransactionCode($orderId, $transactionCode);
        }
        return true;
    }