repository = $repository; } public function execute(?String $serviceId = null, ServiceObject $serviceObject){ try{ $this->repository->updateOrCreate( [ 'id' => $serviceId, ], [ 'name' => $serviceObject->getName(), 'type' => $serviceObject->getType(), 'description' => $serviceObject->getDescription(), 'cost' => $serviceObject->getCost(), 'forwarder_id' => $serviceObject->getForwarderId(), ]); return new JsonResponse([],HttpStatus::OK); }catch(\Exception $exception){ throw new InternalServerErrorException("Failed to update Service Fees because {$exception->getMessage()}"); } } }