private Set<Shape> getAuthDefShapesToReplace(Model model, Set<ShapeId> removedShapeIds) {
        Set<Shape> shapes = new HashSet<>();
        for (StructureShape structure : model.getStructureShapesWithTrait(AuthDefinitionTrait.class)) {
            AuthDefinitionTrait authDefTrait = structure.expectTrait(AuthDefinitionTrait.class);
            List<ShapeId> traits = authDefTrait.getTraits();
            List<ShapeId> newTraits = excludeTraitsInSet(traits, removedShapeIds);
            // Return early if re-built list of traits is the same as existing list.
            if (!traits.equals(newTraits)) {
                // If the list of traits on the AuthDefinitionTrait has changed due to a trait shape being
                // removed from the model, return a new version of the shape with a new version of the trait.
                shapes.add(structure.toBuilder()
                        .addTrait(authDefTrait.toBuilder().traits(newTraits).build())
                        .build());
            }
        }
        return shapes;
    }
Removes traits from {@link AuthDefinitionTrait} and
{@link ProtocolDefinitionTrait} traits that refer to removed shapes.
smithy-model/src/main/java/software/amazon/smithy/model/transform/plugins/CleanTraitDefinitions.java