Adds additional tables checks and sortation for parentid