public Session createSessionFromInput(CreateSessionDialog createSessionDialog)
 {
     return(new Session()
     {
         name = createSessionDialog.courseNameText,
         subjectNumber = createSessionDialog.courseIdText,
         sessionType = Session.SessionType.USER_DEFINED
     });
 }
 private void createCourseButton_Click(object sender, EventArgs e)
 {
     using (CreateSessionDialog createSessionDialog = new CreateSessionDialog())
     {
         if (createSessionDialog.ShowDialog() == DialogResult.OK)
         {
             if (string.IsNullOrEmpty(createSessionDialog.courseNameText))
             {
                 MessageBox.Show("課程名稱要填");
             }
             else
             {
                 var session = createSessionFromInput(createSessionDialog);
                 sessionManagementPressenter.createSession(session);
                 // TODO: UX needed make sure if the session actually stored successfully.
                 ListViewItem item = new ListViewItem(createSessionDialog.courseNameText);
                 item.SubItems.Add(createSessionDialog.courseIdText);
                 sessionManagementDialogListView.Items.Add(item);
             }
         }
     }
 }