protected function setIsFirst(OrderInterface $order)
    {
        if (null !== $customer = $order->getCustomer()) {
            if ($customer->hasParent()) {
                $customer = $customer->getParent();
            }
            $first = !$this->orderRepository->existsForCustomer($customer);
        } else {
            $first = !$this->orderRepository->existsForEmail($order->getEmail());
        }

        if ($first != $order->isFirst()) {
            $order->setFirst($first);

            return true;
        }

        return false;
    }