private void EditRow(int idx)
 {
     using (TrainClassEditForm tcef = new TrainClassEditForm {
         Model = _model[idx].Copy()
     })
     {
         DialogResult result = tcef.ShowDialog();
         if (result == DialogResult.OK)
         {
             tcef.Model.CopyTo(_model[idx]);
             UpdateViewToModel();
         }
     }
 }
 private void BtnAdd_Click(object sender, EventArgs e)
 {
     using (TrainClassEditForm tcef = new TrainClassEditForm {
         Model = new TrainClass {
             Id = GeneralHelper.GetNewId(_model)
         }
     })
     {
         DialogResult result = tcef.ShowDialog();
         if (result == DialogResult.OK)
         {
             _model.Add(tcef.Model);
             UpdateViewToModel();
         }
     }
 }