def _to_json(self, include_references=True):
        """Convert the model to JSON using the PotionJSONEncode and automatically
        resolving the resource as needed (`_properties` call handles this).
        """
        if include_references:
            return json.dumps(self._resource._properties, cls=PotionJSONEncoder)
        else:
            return json.dumps(
                {
                    k: v
                    for k, v in self._resource._properties.items()
                    if not isinstance(v, Resource) and not k.startswith("$")
                },
                cls=PotionJSONEncoder,
            )
Convert the model to JSON using the PotionJSONEncode and automatically
        resolving the resource as needed (`_properties` call handles this).