def save(self, **kwargs):  # type: ignore[no-untyped-def]
        """
        Create the identity with the associated traits
        (optionally store traits if flag set on org)
        """
        identifier = self.validated_data.get("identifier")
        environment = self.context["environment"]
        transient = self.validated_data["transient"]
        sdk_trait_data: list[SDKTraitData] = self.validated_data.get("traits", [])

        if not identifier:
            # We have a fully transient identity that should never be persisted.
            identity, traits = get_transient_identity_and_traits(
                environment=environment,
                sdk_trait_data=sdk_trait_data,
            )

        elif transient:
            # Don't persist incoming data but load presently stored
            # overrides and traits, if any.
            identity, traits = get_identified_transient_identity_and_traits(
                environment=environment,
                identifier=identifier,
                sdk_trait_data=sdk_trait_data,
            )

        else:
            # Persist the identity in accordance with individual trait transiency
            # and persistence settings outside of request context.
            identity, traits = get_persisted_identity_and_traits(
                environment=environment,
                identifier=identifier,
                sdk_trait_data=sdk_trait_data,
            )

        all_feature_states = identity.get_all_feature_states(
            traits=traits,
            additional_filters=self.context.get("feature_states_additional_filters"),
        )
        identify_integrations(identity, all_feature_states, traits)  # type: ignore[no-untyped-call]

        return {
            "identity": identity,
            "identifier": identity.identifier,
            "traits": traits,
            "flags": all_feature_states,
        }

        Create the identity with the associated traits
        (optionally store traits if flag set on org)
        
api/environments/sdk/serializers.py