public static IServiceCollection RegisterNotificationHandler <TNotification, THandler>(this IServiceCollection services)
            where THandler : INotificationHandler <TNotification>
            where TNotification : INotification
        {
            Type messageType = typeof(Message <TNotification>);

            MessageMapping mapping = new MessageMapping(messageType,
                                                        typeof(TNotification),
                                                        typeof(THandler),
                                                        typeof(INotificationHandler <TNotification>),
                                                        typeof(NotificationHandlerWrapper <TNotification>));

            MainConfiguration.AddMapping(mapping);
            services.TryAddTransient(mapping.HandlerInterfaceType, mapping.HandlerType);

            return(services);
        }
        public static IServiceCollection RegisterCommandHandler <TCommand, THandler, TResult>(this IServiceCollection services)
            where THandler : ICommandHandler <TCommand, TResult>
            where TCommand : ICommand <TResult>
        {
            Type messageType = typeof(Message <TCommand>);

            MessageMapping mapping = new MessageMapping(messageType,
                                                        typeof(TCommand),
                                                        typeof(TResult),
                                                        typeof(THandler),
                                                        typeof(ICommandHandler <TCommand, TResult>),
                                                        typeof(CommandHandlerWrapper <TCommand, TResult>));

            MainConfiguration.AddMapping(mapping);
            services.TryAddTransient(mapping.HandlerInterfaceType, mapping.HandlerType);

            return(services);
        }