private static void persistStudents(IEnumerable<StudentPackage> students, IStudentDownloadRepository downloadRepo, IStudentErrorRepository errorRepo) { try { students.ForEach(s => saveStudent(s, downloadRepo, errorRepo)); } catch (Exception ex) { Console.WriteLine("Error! " + ex.Message); } }
private static void saveStudent(StudentPackage stPkg, IStudentDownloadRepository repo, IStudentErrorRepository errorRepo) { try { repo.Save(stPkg); } catch (Exception ex) { errorRepo.Save(stPkg, ex); } }