public void Add(AutoSave savable) { lock (m_threads) { var bot = savable.Bot; AsyncTaskManager value; if (!m_threads.TryGetValue(savable.Bot, out value)) { m_threads[bot] = value = new AsyncTaskManager(bot); bot.EndShutdown += bot_EndShutdown; } value.Add(savable); } }