LPS-44697 We don't want to iterate over the current group again because we have already checked that in the previous if condition. Then, create a new method that only obtains the ancestorSiteGroupIds.