public async Task InitAsync()
        {
            const int snapshotId = 0;

            var fullSnapshot = await InitQueueSnapshot();

            _queueSnapshotCache.Init(fullSnapshot, snapshotId);
            _queueSnapshotWriter.Init(snapshotId);

            var tasks = new List <Task>();

            foreach (var topicAndQueuesSnapshot in fullSnapshot)
            {
                var pageId = MessagesContentPagesUtils.GetPageId(topicAndQueuesSnapshot.MessageId);

                var task = _schedulerByTopic.ExecuteTaskAsync(topicAndQueuesSnapshot.TopicId, pageId, "Init", async() =>
                {
                    await _restorePageFromBlobOperation.TryRestoreFromUncompressedPage(topicAndQueuesSnapshot.TopicId, pageId);
                });

                tasks.Add(task);
            }

            await Task.WhenAll(tasks);

            _appGlobalFlags.Initialized = true;

            _appLogger.AddLog(LogProcess.System, null, "SYSTEM", "Application Initialized");
        }
        public async Task <IMessageContentPage> LoadPageIntoCacheTopicSynchronizedAsync(string topicId, MessagePageId pageId)
        {
            var page = _messagesContentCache.TryGetPage(topicId, pageId);

            if (page != null)
            {
                return(page);
            }

            return(await _restorePageFromBlobOperation.TryRestoreFromCompressedPage(topicId, pageId)
                   ?? await _restorePageFromBlobOperation.TryRestoreFromUncompressedPage(topicId, pageId));
        }