def validate_fields(self, data):
        """
        This validator is used to only allow users to update the field entry for their user.
        It's not possible to exclude it because without the PK Marshmallow cannot load the right instance
        """
        fields = data.get("fields")
        if fields is None:
            return

        current_team = get_current_team()

        if is_admin():
            team_id = data.get("id")
            if team_id:
                target_team = Teams.query.filter_by(id=data["id"]).first()
            else:
                target_team = current_team

            # We are editting an existing
            if self.view == "admin" and self.instance:
                target_team = self.instance
                provided_ids = []
                for f in fields:
                    f.pop("id", None)
                    field_id = f.get("field_id")

                    # # Check that we have an existing field for this. May be unnecessary b/c the foriegn key should enforce
                    field = TeamFields.query.filter_by(id=field_id).first_or_404()

                    # Get the existing field entry if one exists
                    entry = TeamFieldEntries.query.filter_by(
                        field_id=field.id, team_id=target_team.id
                    ).first()
                    if entry:
                        f["id"] = entry.id
                        provided_ids.append(entry.id)

                # Extremely dirty hack to prevent deleting previously provided data.
                # This needs a better soln.
                entries = (
                    TeamFieldEntries.query.options(load_only("id"))
                    .filter_by(team_id=target_team.id)
                    .all()
                )
                for entry in entries:
                    if entry.id not in provided_ids:
                        fields.append({"id": entry.id})
        else:
            provided_ids = []
            for f in fields:
                # Remove any existing set
                f.pop("id", None)
                field_id = f.get("field_id")
                value = f.get("value")

                # # Check that we have an existing field for this. May be unnecessary b/c the foriegn key should enforce
                field = TeamFields.query.filter_by(id=field_id).first_or_404()

                # Get the existing field entry if one exists
                entry = TeamFieldEntries.query.filter_by(
                    field_id=field.id, team_id=current_team.id
                ).first()

                if field.required is True:
                    if isinstance(value, str):
                        if value.strip() == "":
                            raise ValidationError(
                                f"Field '{field.name}' is required",
                                field_names=["fields"],
                            )

                if field.editable is False and entry is not None:
                    raise ValidationError(
                        f"Field '{field.name}' cannot be editted",
                        field_names=["fields"],
                    )

                if entry:
                    f["id"] = entry.id
                    provided_ids.append(entry.id)

            # Extremely dirty hack to prevent deleting previously provided data.
            # This needs a better soln.
            entries = (
                TeamFieldEntries.query.options(load_only("id"))
                .filter_by(team_id=current_team.id)
                .all()
            )
            for entry in entries:
                if entry.id not in provided_ids:
                    fields.append({"id": entry.id})

        This validator is used to only allow users to update the field entry for their user.
        It's not possible to exclude it because without the PK Marshmallow cannot load the right instance
        
CTFd/schemas/teams.py