private static void CleanStateCache(object o, CancellationToken cancellationToken) { try { foreach (var c in StateStorage.Where(i => i.Value.Created < DateTime.UtcNow.AddHours(-3)).ToArray()) { StardustContextProvider deprecatedItem; lock (StateStorage) StateStorage.TryRemove(c.Key, out deprecatedItem); } } catch { } }