public AnalysisStorage(ITaskScheduler taskScheduler,
                               IFilesystem filesystem,
                               IDataSourceAnalyserEngine dataSourceAnalyserEngine,
                               ITypeFactory typeFactory)
        {
            _taskScheduler            = taskScheduler ?? throw new ArgumentNullException(nameof(taskScheduler));
            _dataSourceAnalyserEngine = dataSourceAnalyserEngine ?? throw new ArgumentNullException(nameof(dataSourceAnalyserEngine));
            _filesystem  = filesystem ?? throw new ArgumentNullException(nameof(filesystem));
            _typeFactory = typeFactory ?? throw new ArgumentNullException(nameof(typeFactory));
            _syncRoot    = new object();

            _snapshots         = new SnapshotsWatchdog(taskScheduler, filesystem, typeFactory);
            _templates         = new List <ActiveAnalysisConfiguration>();
            _analyses          = new Dictionary <AnalysisId, ActiveAnalysis>();
            _lastSavedAnalyses = new Dictionary <AnalysisId, ActiveAnalysisConfiguration>();

            // TODO: Maybe don't block in the ctor in the future?
            // If we do that, the public interface will have to be changed
            RestoreSavedAnalysesAsync().Wait();
        }
        public ActiveAnalysis(
            AnalysisId id,
            AnalysisTemplate template,
            ITaskScheduler taskScheduler,
            IDataSourceAnalyserEngine analyserEngine,
            TimeSpan maximumWaitTime)
        {
            if (template == null)
            {
                throw new ArgumentNullException(nameof(template));
            }
            if (taskScheduler == null)
            {
                throw new ArgumentNullException(nameof(taskScheduler));
            }
            if (analyserEngine == null)
            {
                throw new ArgumentNullException(nameof(analyserEngine));
            }

            _id              = id;
            _template        = template;
            _taskScheduler   = taskScheduler;
            _maximumWaitTime = maximumWaitTime;
            _logFiles        = new Dictionary <DataSourceId, ILogFile>();
            _logFile         = new LogFileProxy(taskScheduler, maximumWaitTime);
            _analyserEngine  = analyserEngine;
            _analysers       = new Dictionary <IDataSourceAnalyser, AnalyserTemplate>();
            _syncRoot        = new object();

            foreach (var analysisTemplate in template.Analysers)
            {
                // TODO: Solve this conundrum
                Add((AnalyserTemplate)analysisTemplate);
            }
        }