public IEnumerator <ITask> EventsQueryHandler(EventsQuery query)
        {
            EventsQueryRequestType request  = query.Body;
            EventsQueryResponse    response = new EventsQueryResponse();

            response.Events = new List <EventListEntry>();
            foreach (EventListEntry entry in _state.SpeechEvents)
            {
                if (entry.Timestamp > request.NewerThanTimestamp)
                {
                    response.Events.Add(entry);
                }
            }

            query.ResponsePort.Post(response);
            yield break;
        }
        /// <summary>
        /// Events HTTP query handler
        /// </summary>
        /// <param name="query"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        private IEnumerator <ITask> EventsHttpQueryHandler(HttpQuery query, NameValueCollection parameters)
        {
            // Parse timestamp (TryParse sets the timestamp to zero if parsing fails)
            long timestamp;

            long.TryParse(parameters["timestamp"], out timestamp);

            // Send EventsQuery message to own service
            EventsQueryRequestType eventsQueryRequest = new EventsQueryRequestType();

            eventsQueryRequest.NewerThanTimestamp = timestamp;
            EventsQuery eventsQuery = new EventsQuery();

            eventsQuery.Body = eventsQueryRequest;
            _mainPort.Post(eventsQuery);

            DsspResponsePort <EventsQueryResponse> eventsResponse = eventsQuery.ResponsePort;

            yield return((Choice)eventsResponse);

            Fault eventsFault = (Fault)eventsResponse;

            if (eventsFault != null)
            {
                LogError(eventsFault);
                query.ResponsePort.Post(new HttpResponseType(
                                            HttpStatusCode.InternalServerError,
                                            eventsFault
                                            ));
                yield break;
            }

            // Return EventsQuery result
            query.ResponsePort.Post(new HttpResponseType(
                                        HttpStatusCode.OK,
                                        (EventsQueryResponse)eventsResponse
                                        ));
            yield break;
        }