I think this might be the case because I have just experienced another error when using InsertQuery. I have 2 inserts on one page and the second insert uses the saveInSession from the first query, but when I submit the form I am getting this error..
Warning: Undefined array key "ContractID" in ....