consider group hierarchy when merging metadata