public static void SyncToCanvas() { try { SyncronizationDAL.SyncToCanvas(); List <sp_get_uniCanvas_ws_cursos_Result> courseToSyncList = CourseDAL.CoursesToSync(); List <string> createdCoursesList = new List <string>(); foreach (sp_get_uniCanvas_ws_cursos_Result courseToSync in courseToSyncList) { try { CourseController courseController = new CourseController(); Course course = new Course(); course.course = new CourseDTO(courseToSync); CourseReturn newCourse = (CourseReturn)courseController.Create(course); if (newCourse != null) { CourseDAL.UpdateCanvasData(courseToSync.IDAcademico.ToString(), newCourse); } } catch (Exception e) { CourseReturn newCourse = new CourseReturn() { error_message = e.Message }; CourseDAL.UpdateCanvasData(courseToSync.IDAcademico.ToString(), newCourse); } } } catch (Exception e) { return; } }