private void EventReportReceived(EventReportPDU eventReportPdu)
        {
            uint eventType = eventReportPdu.EventType;

            if (subscribersByEventType.ContainsKey(eventType) && subscribersByEventType[eventType].Count > 0)
            {
                if (eventReportsTypes.ContainsKey(eventType))
                {
                    Type eventReportType    = eventReportsTypes[eventType];
                    BaseCustomEventReport o = (BaseCustomEventReport)Activator.CreateInstance(eventReportType);

                    var eventReportData = new CustomEventReportEncoder(eventReportPdu, o);

                    o.SenderId   = eventReportData.SenderId;
                    o.ReceiverId = eventReportData.ReceiverId;

                    foreach (var field in eventReportType.GetFields())
                    {
                        field.SetValue(o, eventReportData.Read(field.FieldType, field));
                    }

                    foreach (var subscriber in subscribersByEventType[eventType])
                    {
                        subscriber(o);
                    }
                }
            }
        }
        public void Send(BaseCustomEventReport eventReport)
        {
            var eventReportAttr = GetCustomEventreportAttribute(eventReport);

            if (eventReportAttr == null)
            {
                throw new Exception("Event report must have CustomEventReportAttribute");
            }

            var eventReportData = new CustomEventReportEncoder(eventReportAttr.EventReportType, eventReport);

            eventReportData.SenderId   = eventReport.SenderId;
            eventReportData.ReceiverId = eventReport.ReceiverId;

            foreach (var field in eventReport.GetType().GetFields())
            {
                if (field.Name == "SenderId" || field.Name == "ReceiverId")
                {
                    continue;
                }
                var value = field.GetValue(eventReport);
                eventReportData.Write(value, field);
            }

            _exerciseConnection.SendPDU(eventReportData.EventReportPdu);
        }