private void add(StreamEvent streamEvent) {
        StreamEvent existingValue = null;
        if (primaryKeyData != null) {
            Object primaryKey = constructPrimaryKey(streamEvent, primaryKeyReferenceHolders);
            existingValue = primaryKeyData.putIfAbsent(primaryKey, streamEvent);
            if (existingValue != null) {
                Exception e = new SiddhiAppRuntimeException("Siddhi App '" + siddhiAppName + "' table '" +
                        tableName + "' dropping event : " + streamEvent + ", as there is already an event stored " +
                        "with primary key '" + primaryKey + "'");
                if (siddhiAppContext.getRuntimeExceptionListener() != null) {
                    siddhiAppContext.getRuntimeExceptionListener().exceptionThrown(e);
                }
                log.error(e.getMessage(), e);
            }
        }

        if (indexData != null) {
            for (Map.Entry<String, Integer> indexEntry : indexMetaData.entrySet()) {
                TreeMap<Object, Set<StreamEvent>> indexMap = indexData.get(indexEntry.getKey());
                Object key = streamEvent.getOutputData()[indexEntry.getValue()];
                Set<StreamEvent> values = indexMap.get(key);
                if (values == null) {
                    values = new HashSet<StreamEvent>();
                    values.add(streamEvent);
                    indexMap.put(streamEvent.getOutputData()[indexEntry.getValue()], values);
                } else {
                    values.add(streamEvent);
                }
            }
        }

    }
EventHolder implementation where events will be indexed and stored. This will offer faster access compared to
other EventHolder implementations. User can only add unique events based on a given primary key.
modules/siddhi-core/src/main/java/io/siddhi/core/table/holder/IndexEventHolder.java