class EventAnalyticsUtils {

    public static Map<String, Object> getAggregatedEventDataMapping( Grid grid )
    {
        Map<String, Object> map = new HashMap<>();

        int metaCols = grid.getWidth() - 1;
        int valueIndex = grid.getWidth() - 1;

        for ( List<Object> row : grid.getRows() )
        {
            List<String> ids = new ArrayList<>();

            for ( int index = 0; index < metaCols; index++ )
            {
                Object id = row.get( index );

                if ( id != null )
                {
                    ids.add( (String) row.get( index ) );
                }
            }

            Collections.sort( ids );

            String key = StringUtils.join( ids, DIMENSION_SEP );
            Object value = row.get( valueIndex );

            map.put( key, value );
        }

        return map;
    }

}