class FruIdEventsHelperUtil {

    public static List<Event> addFruIDtoEthernetControllerEvents( List<Event> aggregatedEvents,
                                                                  List<EthernetController> ethernetControllerList )
    {

        List<Event> events = new ArrayList<Event>();
        EthernetController ethernetController = new EthernetController();

        try
        {
            for ( int i = 0; i < aggregatedEvents.size(); i++ )
            {
                Event event = aggregatedEvents.get( i );
                Map<EventComponent, String> eventComponentIdentifier = event.getHeader().getComponentIdentifier();
                Map<String, String> eventBody = event.getBody().getData();
                String componentId = eventComponentIdentifier.get( EventComponent.NIC );

                boolean foundEthernetControllerFru = false;
                for ( int j = 0; j < ethernetControllerList.size() && foundEthernetControllerFru == false; j++ )
                {
                    for ( int k = 0; k < ethernetControllerList.get( j ).getPortInfos().size(); k++ )
                    {
                        if ( componentId.contains( ethernetControllerList.get( j ).getPortInfos().get( k ).getDeviceName() ) )
                        {
                            ethernetController = ethernetControllerList.get( j );
                            eventBody.put( "fruID", ethernetController.getFruId() );
                            foundEthernetControllerFru = true;
                            break;
                        }
                    }
                }
                events.add( event );
            }
            return events;
        }
        catch ( Exception e )
        {
            logger.error( "HMS aggregator error in adding Fru ID to Ethernet Controller or NIC Events", e );
        }

        return null;
    }

}