class PostmanService {

    void mapFailuresToScenarios(List<Failure> failures, List<NewmanScenario> newmanScenarios) {
        for (Failure failure : failures) {
            Optional<NewmanScenario> newmanScenario = findByItemId(newmanScenarios, failure.getSource().getId());
            if (newmanScenario.isPresent()) {
                newmanScenario.get().getFailures().add(failure);
            } else {
                log.error("Failure {} has no matching item in the Postman collection", failure.getSource().getId());
            }
        }
    }

}