public List <string> GetCourses(string Ins_name, string Dept_name) { //function to get the list of courses in a department of an institute for the dropbox once the department in also chosen Institute Ins = this._collection.Find(new BsonDocument { { "Name", Ins_name } }).FirstAsync().Result; List <string> Course_names = new List <string>(); foreach (Department D in Ins.Departments) { if (D.Dname.Equals(Dept_name)) { foreach (Course c in D.Courses) { Course_names.Add(c.Cname.ToString()); } } } return(Course_names); }