private function updateContact()
    {
        // Assume no attribution till calculated.
        $this->attribution = 0;

        // Do not update contacts for test runs.
        if ($this->test || !$this->payloadModel) {
            return;
        }

        // Only update contacts if success definitions are met.
        if (!$this->valid) {
            return;
        }

        try {
            $this->dispatchContextCreate();

            // Only API model currently has a map to update contacts based on the response.
            $updatedFields = false;
            if (method_exists($this->payloadModel, 'applyResponseMap')) {
                /** @var bool $updatedFields */
                $updatedFields = $this->payloadModel->applyResponseMap();
                if ($updatedFields) {
                    $this->contact = $this->payloadModel->getContact();
                }
            }

            /** @var Attribution $attribution */
            $attribution = new Attribution($this->contactClient, $this->contact, $this->payloadModel);
            /** @var bool $updatedAttribution */
            $updatedAttribution = $attribution->applyAttribution();
            if ($updatedAttribution) {
                $this->attribution = $attribution->getAttributionChange();
                $this->setLogs(strval(round($this->attribution, 4)), 'attribution');
                if ($this->attribution && method_exists($this->payloadModel, 'setAttribution')) {
                    $this->payloadModel->setAttribution($this->attribution);
                }
            } else {
                $this->setLogs('0', 'attribution');
            }
            $this->setLogs(strval(round($this->contact->getAttribution(), 4)), 'attributionTotal');

            // If any fields were updated, save the Contact entity.
            if ($updatedFields || $updatedAttribution) {
                $this->getContactModel()->saveEntity($this->contact);
                $this->setLogs('Operation successful. The contact was updated.', 'updated');
            } else {
                $this->setLogs('Operation successful, but no fields on the contact needed updating.', 'info');
            }
            if (!$updatedAttribution) {
                // Fields may have updated, but not attribution, so the ledger needs an event to capture conversions.
                $this->dispatchContextCapture();
            }
        } catch (\Exception $e) {
            $this->valid = false;
            $this->setLogs('Operation completed, but we failed to update our Contact. '.$e->getMessage(), 'error');
            $this->logIntegrationError($e, $this->contact);
            $this->retry = false;
        }
    }