class EventDataValueAggregator {

    public Map<String, Set<EventDataValue>> aggregateDataValues( List<Event> events,
        Map<String, ProgramStageInstance> programStageInstanceMap, ImportOptions importOptions )
    {
        checkNotNull( programStageInstanceMap );
        checkNotNull( events );

        Map<String, Set<EventDataValue>> eventDataValueMap = new HashMap<>();
        for ( Event event : events )
        {
            if ( isNew( event.getUid(), programStageInstanceMap ) )
            {
                eventDataValueMap.put( event.getUid(), getDataValues( event.getDataValues() ) );
            }
            else
            {
                eventDataValueMap.put( event.getUid(),
                    aggregateForUpdate( event, programStageInstanceMap, importOptions ) );
            }
        }
        return eventDataValueMap;
    }

}