carrierRepo->findByEmail($dto->email) !== null) { throw new InvalidArgumentException(); } $carrier = new Carrier( null, $dto->email, $dto->companyName, $dto->contactPerson, $dto->phoneNumber, $dto->notes, $dto->loadProfile, $dto->countriesServing, [], ); return $this->carrierRepo->save($carrier); } }