re #8970 Check ws belongs to group before inserting it

This get rids of warning message in SANS reduction due to inserting
workspace to a group which already had that workspace.