def METHOD_NAME(self, AttachmentsData, invoice_id):
    AttachModel = self.env["fatturapa.attachments"]
    for attach in AttachmentsData:
        if not attach.NomeAttachment:
            name = _("Attachment without name")
        else:
            name = attach.NomeAttachment
        content = attach.Attachment.encode()
        _attach_dict = {
            "name": name,
            "datas": content,
            "description": attach.DescrizioneAttachment or "",
            "compression": attach.AlgoritmoCompressione or "",
            "format": attach.FormatoAttachment or "",
            "invoice_id": invoice_id,
        }
        AttachModel.create(_attach_dict)