public MessagingController(
            IGlobalSessionsRegistry sessionsRegistry,
            IGroupChatsRepository groupChatsRepository,
            IDevicesRepository devicesRepository,
            ProcessedMessagesQueue processedMessagesQueue,
            ISessionsServer server,
            IUndeliveredEventsRepository<Message> undeliveredMessagesRepository,
            IUndeliveredEventsRepository<DeliveryNotification> undeliveredDeliveryNotificationsRepository,
            IUndeliveredEventsRepository<SeenNotification> undeliveredSeenNotificationsRepository,
            IInternalMessageBus internalMessageBus)
        {
            _groupChatsRepository = groupChatsRepository;
            _devicesRepository = devicesRepository;
            _processedMessagesQueue = processedMessagesQueue;

            _messageEventManager = new ReliableEventManager<Message, IncomingMessage>(server,
                undeliveredMessagesRepository, sessionsRegistry,internalMessageBus,MessageDtoConverter, OnMessageProcessed);
            RegisterPulsable(_messageEventManager);

            _deliveryStatusEventManager = new ReliableEventManager<DeliveryNotification, ServerClient.Entities.Ws.Events.DeliveryNotification>(server,
                undeliveredDeliveryNotificationsRepository, sessionsRegistry, internalMessageBus,
                n => new ServerClient.Entities.Ws.Events.DeliveryNotification { MessageToken = n.MessageToken, EventId = n.EventId, DeliveredAt = n.CreatedAt });
            RegisterPulsable(_deliveryStatusEventManager);

            _seenStatusEventManager = new ReliableEventManager<SeenNotification, ServerClient.Entities.Ws.Events.SeenNotification>(server, 
                 undeliveredSeenNotificationsRepository, sessionsRegistry, internalMessageBus,
                n => new ServerClient.Entities.Ws.Events.SeenNotification { MessageToken = n.MessageToken, EventId = n.EventId, SeenAt = n.CreatedAt });
            RegisterPulsable(_seenStatusEventManager);

            _isTypingEventManager = new InstantEventManager<IsTypingEvent, IsTypingNotification>(server,
                sessionsRegistry, internalMessageBus, n => new IsTypingNotification { IsTyping = n.IsTyping, SenderUserId = n.SenderUserId, GroupId = n.GroupId });
            RegisterPulsable(_isTypingEventManager);
        }
        public GroupChatsController(ISessionsServer server,
                                    IDevicesRepository devicesRepository,
                                    IUndeliveredEventsRepository <GroupChangedEvent> undeliveredGroupChangedEventsRepository,
                                    IGroupChatsRepository groupChatsRepository,
                                    IGlobalSessionsRegistry sessionsRegistry,
                                    IInternalMessageBus internalMessageBus)
        {
            _devicesRepository        = devicesRepository;
            _groupChatsRepository     = groupChatsRepository;
            _groupChangedEventManager = new ReliableEventManager <GroupChangedEvent, ClientDto.Events.GroupChangedNotification>(server,
                                                                                                                                undeliveredGroupChangedEventsRepository,
                                                                                                                                sessionsRegistry,
                                                                                                                                internalMessageBus,
                                                                                                                                GroupChangedDtoConverter);

            RegisterPulsable(_groupChangedEventManager);
        }
        public MessagingController(
            IGlobalSessionsRegistry sessionsRegistry,
            IGroupChatsRepository groupChatsRepository,
            IDevicesRepository devicesRepository,
            ProcessedMessagesQueue processedMessagesQueue,
            ISessionsServer server,
            IUndeliveredEventsRepository <Message> undeliveredMessagesRepository,
            IUndeliveredEventsRepository <DeliveryNotification> undeliveredDeliveryNotificationsRepository,
            IUndeliveredEventsRepository <SeenNotification> undeliveredSeenNotificationsRepository,
            IInternalMessageBus internalMessageBus)
        {
            _groupChatsRepository   = groupChatsRepository;
            _devicesRepository      = devicesRepository;
            _processedMessagesQueue = processedMessagesQueue;

            _messageEventManager = new ReliableEventManager <Message, IncomingMessage>(server,
                                                                                       undeliveredMessagesRepository, sessionsRegistry, internalMessageBus, MessageDtoConverter, OnMessageProcessed);
            RegisterPulsable(_messageEventManager);

            _deliveryStatusEventManager = new ReliableEventManager <DeliveryNotification, ServerClient.Entities.Ws.Events.DeliveryNotification>(server,
                                                                                                                                                undeliveredDeliveryNotificationsRepository, sessionsRegistry, internalMessageBus,
                                                                                                                                                n => new ServerClient.Entities.Ws.Events.DeliveryNotification {
                MessageToken = n.MessageToken, EventId = n.EventId, DeliveredAt = n.CreatedAt
            });
            RegisterPulsable(_deliveryStatusEventManager);

            _seenStatusEventManager = new ReliableEventManager <SeenNotification, ServerClient.Entities.Ws.Events.SeenNotification>(server,
                                                                                                                                    undeliveredSeenNotificationsRepository, sessionsRegistry, internalMessageBus,
                                                                                                                                    n => new ServerClient.Entities.Ws.Events.SeenNotification {
                MessageToken = n.MessageToken, EventId = n.EventId, SeenAt = n.CreatedAt
            });
            RegisterPulsable(_seenStatusEventManager);

            _isTypingEventManager = new InstantEventManager <IsTypingEvent, IsTypingNotification>(server,
                                                                                                  sessionsRegistry, internalMessageBus, n => new IsTypingNotification {
                IsTyping = n.IsTyping, SenderUserId = n.SenderUserId, GroupId = n.GroupId
            });
            RegisterPulsable(_isTypingEventManager);
        }