public static Map<Dimension, Integer> consolidate(Map<Dimension, Integer> product) {
        LinkedHashMap<Dimension, Integer> consolidatedProduct = new LinkedHashMap<Dimension, Integer>();

        for (Map.Entry<Dimension, Integer> entry : product.entrySet()) {
            final Map<Dimension, Integer> productDimensions = entry.getKey().getProductDimensions();
            if (productDimensions.size() == 0) {
                // Dimensionless !
                // No impact on anything.
            }

            if (productDimensions.size() == 1) {
                // Fundamental dimension.
                if (consolidatedProduct.containsKey(entry.getKey())) {
                    final int value = consolidatedProduct.get(entry.getKey()) + entry.getValue();
                    if (value == 0) {
                        consolidatedProduct.remove(entry.getKey());
                    } else {
                        consolidatedProduct.put(entry.getKey(),
                                value);
                    }
                } else if (entry.getValue() != 0) {
                    consolidatedProduct.put(entry.getKey(), entry.getValue());
                }
            } else {
                // Non fundamental dimension, must be exploded
                // First consolidate it.
                Map<Dimension, Integer> cons = consolidate(productDimensions);
                for (Map.Entry<Dimension, Integer> consolidatedEntry : cons.entrySet()) {
                    final Dimension dimension = consolidatedEntry.getKey();
                    if (consolidatedProduct.containsKey(dimension)) {
                        final int value = consolidatedProduct.get(dimension) + consolidatedEntry.getValue();
                        if (value == 0) {
                            consolidatedProduct.remove(dimension);
                        } else {
                            consolidatedProduct.put(dimension,
                                    value);
                        }
                    } else {
                        consolidatedProduct.put(dimension, consolidatedEntry.getValue());
                    }
                }
            }
        }

        return consolidatedProduct;
    }