def populate_through_models(
        model: "Model",
        model_dict: Dict,
        include: Union[Set, Dict],
        exclude: Union[Set, Dict],
        relation_map: Dict,
    ) -> None:
        """
        Populates through models with values from dict representation.

        :param model: model to populate through models
        :type model: Model
        :param model_dict: dict representation of the model
        :type model_dict: Dict
        :param include: fields to include
        :type include: Dict
        :param exclude: fields to exclude
        :type exclude: Dict
        :param relation_map: map of relations to follow to avoid circular refs
        :type relation_map: Dict
        :return: None
        :rtype: None
        """

        include_dict = (
            translate_list_to_dict(include)
            if (include and isinstance(include, Set))
            else include
        )
        exclude_dict = (
            translate_list_to_dict(exclude)
            if (exclude and isinstance(exclude, Set))
            else exclude
        )
        models_to_populate = model._get_not_excluded_fields(
            fields=model.extract_through_names(),
            include=cast(Optional[Dict], include_dict),
            exclude=cast(Optional[Dict], exclude_dict),
        )
        through_fields_to_populate = [
            model.ormar_config.model_fields[through_model]
            for through_model in models_to_populate
            if model.ormar_config.model_fields[through_model].related_name
            not in relation_map
        ]
        for through_field in through_fields_to_populate:
            through_instance = getattr(model, through_field.name)
            if through_instance:
                model_dict[through_field.name] = through_instance.model_dump()

        Populates through models with values from dict representation.

        :param model: model to populate through models
        :type model: Model
        :param model_dict: dict representation of the model
        :type model_dict: Dict
        :param include: fields to include
        :type include: Dict
        :param exclude: fields to exclude
        :type exclude: Dict
        :param relation_map: map of relations to follow to avoid circular refs
        :type relation_map: Dict
        :return: None
        :rtype: None
        
ormar/models/newbasemodel.py