private CollectorItem createCollectorItem(Collector collector, TestDataCreateRequest request)
     throws HygieiaException {
   CollectorItem tempCi = new CollectorItem();
   tempCi.setCollectorId(collector.getId());
   tempCi.setDescription(request.getDescription());
   tempCi.setPushed(true);
   tempCi.setLastUpdated(System.currentTimeMillis());
   Map<String, Object> option = new HashMap<>();
   option.put("jobName", request.getTestJobName());
   option.put("jobUrl", request.getTestJobUrl());
   option.put("instanceUrl", request.getServerUrl());
   tempCi.getOptions().putAll(option);
   tempCi.setNiceName(request.getNiceName());
   if (StringUtils.isEmpty(tempCi.getNiceName())) {
     return collectorService.createCollectorItem(tempCi);
   }
   return collectorService.createCollectorItemByNiceNameAndJobName(
       tempCi, request.getTestJobName());
 }
  private TestResult createTest(CollectorItem collectorItem, TestDataCreateRequest request) {
    TestResult testResult =
        testResultRepository.findByCollectorItemIdAndExecutionId(
            collectorItem.getId(), request.getExecutionId());
    if (testResult == null) {
      testResult = new TestResult();
    }

    testResult.setTargetAppName(request.getTargetAppName());
    testResult.setTargetEnvName(request.getTargetEnvName());
    testResult.setCollectorItemId(collectorItem.getId());
    testResult.setType(request.getType());
    testResult.setDescription(request.getDescription());
    testResult.setDuration(request.getDuration());
    testResult.setEndTime(request.getEndTime());
    testResult.setExecutionId(request.getExecutionId());
    testResult.setFailureCount(request.getFailureCount());
    testResult.setSkippedCount(request.getSkippedCount());
    testResult.setStartTime(request.getStartTime());
    testResult.setSuccessCount(request.getSuccessCount());
    testResult.setTimestamp(request.getTimestamp());
    testResult.setTotalCount(request.getTotalCount());
    testResult.setUnknownStatusCount(request.getUnknownStatusCount());
    testResult.setUrl(request.getTestJobUrl());
    testResult.getTestCapabilities().addAll(request.getTestCapabilities());
    testResult.setBuildId(new ObjectId(request.getTestJobId()));

    return testResultRepository.save(testResult);
  }