public static SubscriptionToken Subscribe <TEvent>(this IEventAggregator eventAggregator, Action <TEvent> action)
        {
            eventAggregator.ArgumentNotNull(nameof(eventAggregator));
            action.ArgumentNotNull(nameof(action));

            return(eventAggregator.Subscribe(action, e => true));
        }
        public static void PublishEvent(this IEventAggregator eventAggregator, IEvent e)
        {
            eventAggregator.ArgumentNotNull(nameof(eventAggregator));
            e.ArgumentNotNull(nameof(e));

            MethodInfo publishMethod = typeof(IEventAggregator).GetMethod(nameof(IEventAggregator.Publish));

            if (publishMethod == null)
            {
                throw new InvalidOperationException($"The {nameof(IEventAggregator.Publish)} of the event aggregator could not be found.");
            }

            MethodInfo genericPublishMethod = publishMethod.MakeGenericMethod(e.GetType());

            genericPublishMethod.Invoke(eventAggregator, new object[] { e });
        }
 protected ModelNode(IEventAggregator eventAggregator, Guid id)
 {
     this.EventAggregator = eventAggregator.ArgumentNotNull(nameof(eventAggregator));
     this.Id = id;
 }