Make sure catalogtree reflects state of map all the time
Only check for existing id's, use existing recursive function
Removing unneede control variable
Simplify code
Small refactoring
Merge pull request #616 from geoadmin/dev_604

Make sure catalogtree reflects state of map all the time