isValid() === false) { return null; } $existingLocation = $this->repository->findOneByGlobalId($newLocation->getGlobalId()); if ($existingLocation === null) { return $newLocation; } $existingLocation->updateFromLocation($newLocation); return $existingLocation; } }