public void Reset(Model.Model m) { m.CancelChanges(); switch (m.Table) { case "Students": Student s = (Student)m; s.Education = (from ed in Educations where ed.ID == (int)s.Data["education_id"] select ed).First(); break; case "Exams": Exam e = (Exam)m; e.Education = (from ed in Educations where ed.ID == (int)e.Data["education_id"] select ed).First(); break; } }