private static void Save <T>(DataServiceCollection <T> dump, Db db) where T : class { foreach (var entity in dump.ToArray()) { try { AddToContext(db, entity); } catch (Exception exception) { Console.WriteLine(JsonConvert.SerializeObject(new { entity, exception })); // whatever, just move on } } }