changed the order of inserts in favour of foreign keys