private Collection<Shape> findMembersThatNeedRemoval(Model model, Collection<Shape> removed) {
        Set<ShapeId> removedIds = new HashSet<>();
        for (Shape shape : removed) {
            removedIds.add(shape.getId());
        }

        Collection<Shape> removeMembers = new HashSet<>();
        for (StructureShape structure : model.getStructureShapes()) {
            for (MemberShape member : structure.members()) {
                if (removedIds.contains(member.getTarget())) {
                    removeMembers.add(member);
                }
            }
        }
        for (UnionShape structure : model.getUnionShapes()) {
            for (MemberShape member : structure.members()) {
                if (removedIds.contains(member.getTarget())) {
                    removeMembers.add(member);
                }
            }
        }
        return removeMembers;
    }
Find members that target a shape that was removed, and ensure
that the member is removed.

@param model Model to check.
@param removed The shapes that were removed.
@return Returns the member shapes that need to be removed because
 their target was removed.
smithy-model/src/main/java/software/amazon/smithy/model/transform/plugins/CleanStructureAndUnionMembers.java