public static IServiceCollection AddEventSourcing(this IServiceCollection services, Action <IEventSourcingBuilder> setupAction)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            IEventSourcingBuilder builder = new EventSourcingBuilder(services)
                                            .UseJsonEventSerializer();

            setupAction?.Invoke(builder);

            return(services);
        }
        public static IServiceCollection AddEventSourcing(
            this IServiceCollection services,
            Action <IEventSourcingBuilder> setupAction)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services
            .AddSingleton(typeof(IAggregateOptionsMonitor <, ,>), typeof(AggregateOptionsMonitor <, ,>))
            ;

            IEventSourcingBuilder builder = new EventSourcingBuilder(services);

            setupAction?.Invoke(builder);

            return(services);
        }