def add_frame(
        self,
        frame_number,
        frame,
        expand_schema=True,
        validate=True,
        dynamic=False,
    ):
        """Adds the frame to this instance.

        If an existing frame with the same frame number exists, it is
        overwritten.

        Unlike :class:`Frames.add_frame`, the provided frame is never modified
        in-place. Instead, a new :class:`FrameView` is constructed internally
        with the contents of the provided frame.

        Args:
            frame_number: the frame number
            frame: a :class:`Frame` or :class:`FrameView`
            expand_schema (True): whether to dynamically add new frame fields
                encountered to the dataset schema. If False, an error is raised
                if the frame's schema is not a subset of the dataset schema
            validate (True): whether to validate values for existing fields
            dynamic (False): whether to declare dynamic embedded document
                fields
        """
        fofu.validate_frame_number(frame_number)

        if not isinstance(frame, (Frame, FrameView)):
            raise TypeError(
                "Expected a %s or %s; found %s"
                % (Frame, FrameView, type(frame))
            )

        frame_view = self._make_frame({"_sample_id": self._sample_id})
        doc = frame_view._doc

        for field, value in frame.iter_fields():
            doc.set_field(
                field,
                value,
                create=expand_schema,
                validate=validate,
                dynamic=dynamic,
                _enforce_read_only=False,
            )
            if frame_view._selected_fields is not None:
                frame_view._selected_fields.add(field)

        doc.set_field("frame_number", frame_number, _enforce_read_only=False)
        self._set_replacement(frame_view)
Adds the frame to this instance.

        If an existing frame with the same frame number exists, it is
        overwritten.

        Unlike :class:`Frames.add_frame`, the provided frame is never modified
        in-place. Instead, a new :class:`FrameView` is constructed internally
        with the contents of the provided frame.

        Args:
            frame_number: the frame number
            frame: a :class:`Frame` or :class:`FrameView`
            expand_schema (True): whether to dynamically add new frame fields
                encountered to the dataset schema. If False, an error is raised
                if the frame's schema is not a subset of the dataset schema
            validate (True): whether to validate values for existing fields
            dynamic (False): whether to declare dynamic embedded document
                fields
        
fiftyone/core/frame.py