id) { // Update existing $contentSource = $this->contentSourceRepository->findById($command->id); if ($contentSource) { $contentSource->update( baseUrl: $command->baseUrl, chapterUrlFormat: $command->chapterUrlFormat, scrapingType: $command->scrapingType, imageSelector: $command->imageSelector, nextPageSelector: $command->nextPageSelector, chapterSelector: $command->chapterSelector, testSlug: $command->testSlug, testChapterNumber: $command->testChapterNumber, ); $this->contentSourceRepository->save($contentSource); } } else { // Create new $contentSource = ContentSource::create( baseUrl: $command->baseUrl, chapterUrlFormat: $command->chapterUrlFormat, scrapingType: $command->scrapingType, imageSelector: $command->imageSelector, nextPageSelector: $command->nextPageSelector, chapterSelector: $command->chapterSelector, testSlug: $command->testSlug, testChapterNumber: $command->testChapterNumber, ); $this->contentSourceRepository->save($contentSource); } } }