private ControlInfo BuildTree(DateTime?date) { CurriculumnTreeView.Nodes.Clear(); var userCurriculums = StudentRecordFinder.GetCurriculumnsForUser(_userId); var controlInfo = new ControlInfo(); foreach (TblCurriculums curriculum in userCurriculums) { var node = new IdendtityNode(curriculum); if (StudentPermissionsHelper.IsDateAllowed(date, _userId, node.ID, node.Type, GetOperationType)) { controlInfo = BuildStages(curriculum, node, date); if (controlInfo != null && controlInfo.IsControlStartsNow) { return(controlInfo); } if (node.ChildNodes.Count != 0) { CurriculumnTreeView.Nodes.Add(node); } } } CurriculumnTreeView.ExpandAll(); return(controlInfo); }