private void AddSubjectNode(Subjects subject, TreeNodeCollection nodes)
    {
        TreeNode node = new TreeNode();

        node.Text        = subject.Name;
        node.NavigateUrl = "";

        nodes.Add(node);

        // Get all the topics for the current subject
        List <Topics> subjectParentTopics = TopicsBL.GetAllBySubjectsandTopics(subject.Id);

        if (subjectParentTopics.Count > 0)
        {
            foreach (Topics topic in subjectParentTopics)
            {
                AddTopics(topic, node.ChildNodes);
            }
        }
    }
    private void AddTopics(Topics topic, TreeNodeCollection nodes)
    {
        TreeNode node = new TreeNode();

        node.Text = topic.Name;
        int TopicId = topic.Id;

        node.NavigateUrl = string.Format("~/User/Download.aspx?Id={0}&branch={1}", TopicId, branchId);

        nodes.Add(node);

        // Get current topic's children
        List <Topics> children = TopicsBL.GetAllByTopics(topic.Id);

        if (children.Count > 1)
        {
            foreach (Topics childTopic in children)
            {
                AddTopics(childTopic, node.ChildNodes);
            }
        }
    }