code: def save(self):
          
          saved = 0
          if not self.objects:
              raise BatchError("Save failed. Batch is empty")
          for deserialized_tx in self.objects:
              try:
                  self.model.objects.get(pk=deserialized_tx.pk)
              except self.model.DoesNotExist:
                  data = {}
                  for field in self.model._meta.get_fields():
                      try:
                          data.update({field.name: getattr(deserialized_tx, field.name)})
                      except AttributeError:
                          pass
                  self.model.objects.create(**data)
                  saved += 1
          return saved
docs: Saves all model instances in the batch as model.