public static List <UserCourseRoleMappingModel> GetStudents(string tutorialCode) { try { var students = new List <UserCourseRoleMapping>(); var rawUsers = SQLAdapter.GetUsersByTutorialCode(tutorialCode); foreach (var user in rawUsers) { var retrievedUser = SQLAdapter.GetUserById(user.Id); if (retrievedUser.Role.Name == "Student") { students.Add(retrievedUser); } } var result = ModelMapper.MapToUsersModel(students); return(result); } catch (Exception e) { return(null); } }