I think these two (remove + insert) should be in a transaction so in case the add fails we don't end up losing parentDir.