code: def _update_attachments_to_cloud(self):
          
          url = self.build_url(self._endpoints.get('attachments').format(
              id=self._parent.object_id))
  
          # ! potentially several api requests can be made by this method.
  
          for attachment in self.__attachments:
              if attachment.on_cloud is False:
                  # upload attachment:
                  response = self._parent.con.post(url,
                                                   data=attachment.to_api_data())
                  if not response:
                      return False
  
                  data = response.json()
  
                  # update attachment data
                  attachment.attachment_id = data.get('id')
                  attachment.content = data.get(self._cc('contentBytes'), None)
                  attachment.on_cloud = True
  
          for attachment in self.__removed_attachments:
              if attachment.on_cloud and attachment.attachment_id is not None:
                  # delete attachment
                  url = self.build_url(self._endpoints.get('attachment').format(
                      id=self._parent.object_id, ida=attachment.attachment_id))
  
                  response = self._parent.con.delete(url)
                  if not response:
                      return False
  
          self.__removed_attachments = []  # reset the removed attachments
  
          log.debug('Successfully updated attachments on {}'.format(
              self._parent.object_id))
  
          return True
docs: Push new, unsaved attachments to the cloud and remove removed
          attachments. This method should not be called for non draft messages.