private void AddPerson(Person anonim) { if (ValidPerson(anonim)) { var student = (Student)anonim; var teacher = (Teacher)anonim; if (ValidStudent(student) || ValidTeacher(teacher)) { MyRepository.AddPerson(anonim); } } }