private function setCustomerAccount($data, Order $order, $patch = false)
    {
        $accountData = $this->getProperty($data, 'customerAccount');
        if ($accountData) {
            if (!array_key_exists('id', $accountData)) {
                throw new MissingOrderAttributeException('account.id');
            }
            $account = $this->accountRepository->find($accountData['id']);
            if (!$account) {
                throw new OrderDependencyNotFoundException('Account', $accountData['id']);
            }
            $order->setCustomerAccount($account);

            return $account;
        } elseif (!$patch) {
            $order->setCustomerAccount(null);
        }

        return null;
    }