private static async void Save(string lessonFolder, string dateModified) { string codePath = lessonFolder + @"\code.pptx"; var lesson = new Lesson(); lesson.Id = DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss tt"); lesson.Name = Path.GetFileName(lessonFolder); lesson.DateModified = dateModified; lesson.Slides = FileHelper.GetLessonSlidesNumber(lesson.Name); var slidesData = PowerpointHelper.GetSlidesData(codePath); lesson.Teacher_Id = slidesData[0].TeacherId; lesson.Subject = slidesData[0].Subject; var lessonSaved = await WebHelper.AddLesson(lesson); if (lessonSaved == "true") { int _questionNumber = 0; for (int i = 0; i < slidesData.Count; i++) { var question = slidesData[i].Question; if (question != null) { question.Id = 1; question.Lesson_Id = lesson.Id; _questionNumber += 1; question.Number = _questionNumber; WebHelper.AddQuestion(question); } } } else { MessageBox.Show($"Lesson {lesson.Name} not saved!"); } }