private static void removeOld(object state) { /*Cleanup*/ TimeSpan pt = TimeSpan.Parse(Security.EnvironmentManagement.getEnvValue("pruningTime")); Storage.StorageManager sm = new Storage.StorageManager(); var pbs = sm.getPublicationsExpired((int)pt.TotalDays); foreach (var it in pbs) { sm.removeEntity <Publication>(it.Key); } }