public Integer getEventId(int parentEventId, String eventName) {

        // clear map if eventMapExpireTime past
        if (eventMapExpireTime.before(Calendar.getInstance().getTime())) {
            Calendar eventMapExpireTimeCal = Calendar.getInstance();
            if (eventMapExpireTimeCal.getTime().toString().contains("Dec 31")) {
                eventMapExpireTimeCal.roll(Calendar.YEAR, 1);
            }   
            eventMapExpireTimeCal.roll(Calendar.DAY_OF_YEAR, 1);
            eventMapExpireTime = eventMapExpireTimeCal.getTime();
            eventMap.clear();
            System.out.println("Cleared the market cache.");
        }

        // check if event in the cache
        if (eventMap.containsKey(eventName)) {
            return eventMap.get(eventName);
        }

        // identify selection but due to throttling wait for 12 secs before
        // calling
        try {
            Thread.sleep(12000);
        } catch (InterruptedException e) {
            // do nothing
        }

        Integer eventId = null;

        GetEventsReq getEventsReq = new GetEventsReq();
        getEventsReq.setHeader(globalHeader);
        getEventsReq.setEventParentId(parentEventId);

        // get the events
        GetEventsResp getEventsResp = bfGlobalService.getEvents(getEventsReq);

        if (getEventsResp.getErrorCode().equals(GetEventsErrorEnum.OK)) {

            List<BFEvent> events = getEventsResp.getEventItems().getBFEvent();

            // loop through the events to find the event
            int i = 0;
            while ((eventId == null) && (i < events.size())) {

                System.out.println(events.get(i).getEventName() + " "
                        + events.get(i).getEventId());

                if (events.get(i).getEventName().contains(eventName)) {
                    eventId = events.get(i).getEventId();
                } else {
                    eventMap.put(events.get(i).getEventName(), events.get(i)
                            .getEventId());
                    eventId = getEventId(events.get(i).getEventId(), eventName);
                }
                i++;
            }
        }

        return eventId;

    }