class CategoryOptionComboSupplier extends AbstractSupplier<Map<String, CategoryOptionCombo>> {

    @Override
    public Map<String, CategoryOptionCombo> get( ImportOptions importOptions, List<Event> events )
    {
        if ( events == null )
        {
            return emptyMap();
        }

        // TODO this should be optimized to execute less SQL queries
        IdScheme idScheme = importOptions.getIdSchemes().getCategoryOptionIdScheme();
        Map<String, CategoryOptionCombo> eventToCocMap = new HashMap<>();
        Map<String, Program> programMap = programSupplier.get( importOptions, events );

        for ( Event event : events )
        {
            Program program = programMap.get( event.getProgram() );

            // Can't proceed with null Program, this will fail during the validation stage
            if ( program == null )
            {
                return emptyMap();
            }

            final CategoryCombo programCatCombo = program.getCategoryCombo();
            final String aoc = event.getAttributeOptionCombo();
            final String attributeCatOptions = event.getAttributeCategoryOptions();

            CategoryOptionCombo categoryOptionCombo;

            if ( isNotEmpty( aoc ) )
            {
                categoryOptionCombo = attributeOptionComboLoader.getCategoryOptionCombo( idScheme, aoc );
                if ( categoryOptionCombo == null )
                {
                    categoryOptionCombo = attributeOptionComboLoader.getDefault();
                }
            }
            else if ( programCatCombo != null && isNotEmpty( attributeCatOptions ) )
            {
                categoryOptionCombo = attributeOptionComboLoader.getAttributeOptionCombo( programCatCombo,
                    attributeCatOptions, aoc, idScheme );
            }
            else
            {
                categoryOptionCombo = attributeOptionComboLoader.getDefault();
            }

            if ( categoryOptionCombo != null )
            {
                eventToCocMap.put( event.getUid(), categoryOptionCombo );
            }
        }

        return eventToCocMap;
    }

    public  CategoryOptionComboSupplier( NamedParameterJdbcTemplate jdbcTemplate, ProgramSupplier programSupplier,
        AttributeOptionComboLoader attributeOptionComboLoader );

}