class AuditExistenceService {

    public AuditCheckObjectGroupResult check(AuditObjectGroup gotDetail, List<StorageStrategy> storageStrategies) throws
        ProcessingStatusException {
        AuditCheckObjectGroupResult result = new AuditCheckObjectGroupResult();
        result.setIdObjectGroup(gotDetail.getId());

        try (final StorageClient storageClient = storageClientFactory.getClient()) {
            for (AuditObject object : gotDetail.getObjects()) {
                AuditCheckObjectResult auditCheckObjectResult = new AuditCheckObjectResult();
                auditCheckObjectResult.setIdObject(object.getId());
                if (PHYSICAL_MASTER.equals(object.getQualifier())) {
                    // Get global information for physical master
                    StorageRacineModel storageInformation = gotDetail.getStorage();
                    List<String> offerIds = StorageStrategyUtils.loadOfferIds(storageInformation.getStrategyId(), storageStrategies);
                    Map<String, Boolean> existsResult = storageClient.exists(storageInformation.getStrategyId(),
                            DataCategory.OBJECT, object.getId(), offerIds);
                    auditCheckObjectResult.getOfferStatuses()
                            .putAll(existsResult.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
                                    e -> BooleanUtils.isTrue(e.getValue()) ? StatusCode.KO : StatusCode.OK)));
                } else {
                    // Get object information
                    StorageJson storageInformation = object.getStorage();
                    List<String> offerIds = StorageStrategyUtils.loadOfferIds(storageInformation.getStrategyId(), storageStrategies);
                    Map<String, Boolean> existsResult = storageClient.exists(storageInformation.getStrategyId(),
                            DataCategory.OBJECT, object.getId(), offerIds);
                    auditCheckObjectResult.getOfferStatuses()
                            .putAll(existsResult.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
                                    e -> BooleanUtils.isTrue(e.getValue()) ? StatusCode.OK : StatusCode.KO)));
                }
                result.getObjectStatuses().add(auditCheckObjectResult);
            }
            result.setStatus(result.getObjectsGlobalStatus());
        } catch (StorageClientException | StorageStrategyNotFoundException e) {
            LOGGER.error("Storage server errors : ", e);
            throw new ProcessingStatusException(StatusCode.FATAL, String.format("Storage server errors : %s", e));
        }

        if (result.getStatus() == null) {
            result.setStatus(StatusCode.OK);
        }

        return result;
    }

    public  AuditExistenceService();
    @VisibleForTesting public  AuditExistenceService(StorageClientFactory storageClientFactory);

}