Parenting of directories working better, and saved a SELECT by using the last inserted ID instead of doing a SELECT after the query.