Try to get some foreign key constraints in place in the database.  Limited success due to existing data (now not being the time to try and clean it up).