I have been tasked to use nested-set-trees to create questionnaire for students that can have many different kinds of questions; radio buttons with various numbers of answers, text boxes, select lists, check boxes and etc each with their own options like mandatory, max length and etc.

I looked at (I can't post the url so if you go to wikipedia and search for "Nested set model") and I understand that, but if I store the date in two tables like this

table: Category
CategoryCode, ParentCategoryCode, CategoryName
1 0 question_type
3 1 essay
5 1 multiple_choice
6 5 radio_buttons
7 5 drop_down
8 7 select_multiple
9 3 required

table: CategoryTree
TreeCode, ID, LeftCode, RightCode
1 1 1 18
1 3 4 7
1 5 10 17
1 6 11 12
1 7 13 16
1 8 14 15
1 9 5 6

I get how I can show the questionaire creator the data based on this, but I don't see a smart way to store the data when students fill out the questionaire. If I store that in another table with the CategoryTree.ID if the survey is changed most of the id's can/will be changed, thus making the table storing the data invalid.

Any idea's about a smart way to save the data from the questionaire?