class CommonUtils {

    public static <U extends TFieldIdEnum, T extends TBase<T, U>> boolean isMapFieldMapOfStringSets(U field,
                                                                                                    T document,
                                                                                                    T documentAdditions,
                                                                                                    T documentDeletions,
                                                                                                    Logger logger) {
        List<Map<String, Object>> maps = Arrays.asList(
                (Map<String, Object>) document.getFieldValue(field),
                (Map<String, Object>) documentAdditions.getFieldValue(field),
                (Map<String, Object>) documentDeletions.getFieldValue(field));
        List<Map<String, ?>> nonEmptyMaps = maps.stream().filter(m -> m != null && !m.isEmpty()).collect(Collectors.toList());
        if (nonEmptyMaps.isEmpty()) {
            logger.info("Field was empty in document, documentAdditions and documentDeletions: " + field.getFieldName());
            return false;
        }

        Object value = nonEmptyMaps.stream().findAny().get().entrySet().stream()
                .map(e -> ((Map.Entry<String, Object>) e).getValue())
                .findAny()
                .get();
        if (!(value instanceof Set)) {
            return false;
        }
        List<Map<String, ?>> nonEmptyMapsContainingNonEmptySet = nonEmptyMaps.stream()
                .filter(m -> nonEmptyMapOfSetsContainsNonEmptySet((Map<String, Set<Object>>) m))
                .collect(Collectors.toList());

        if (nonEmptyMapsContainingNonEmptySet.isEmpty()) {
            logger.warn("Field contained only maps of only empty sets: " + field.getFieldName());
            return false;
        }

        Map<String, Set<Object>> mapWithNonEmptySet = (Map<String, Set<Object>>) nonEmptyMapsContainingNonEmptySet.stream().findAny().get();
        Object element = getNonEmptySetFromMapOfSets(mapWithNonEmptySet).get().stream()
                .findAny().get();
        return (element instanceof String);
    }

    private  CommonUtils();

}