class DetectorServiceImpl implements DetectorService {

    @Override
    public void updateDetector(String uuid, Detector detector) {
        notNull(detector, "detector can't be null");
        MDC.put("DetectorUuid", uuid);

        Detector detectorToBeUpdated = repository.findByUuid(uuid);
        DetectorConfig detectorConfigToUpdate = DetectorDataUtil.buildMergedDetectorConfig(
            detectorToBeUpdated.getDetectorConfig(),
            Optional.ofNullable(detector.getDetectorConfig()));
        detectorToBeUpdated.setDetectorConfig(detectorConfigToUpdate);
        detectorToBeUpdated.setMeta(DetectorDataUtil.buildLastUpdatedDetectorMeta(detector));
        RequestValidator.validateDetector(detectorToBeUpdated);
        repository.save(detectorToBeUpdated);
    }

}