name), $data->title, $data->phone, $data->email === null ? null : new EmailAddress($data->email), $data->note, ); return $this->transactions->run(function () use ($customerId, $contact): int { if ($this->customers->findById($customerId) === null) { throw new CustomerNotFound($customerId); } return (int) $this->contacts->save($contact)->id(); }); } }