private int GetNewCurrentStudent(Student student) { var nextId = -1; if (_model.Students.Count > 1) { var studentInfo = StudentInfo.GetStudentById(student.StudentId); var currentIndex = _model.Students.IndexOf(studentInfo); if (currentIndex < _model.Students.Count - 1) { nextId = _model.Students[currentIndex + 1].StudentId; } else { nextId = _model.Students[currentIndex - 1].StudentId; } } return(nextId); }