code: def save(self, resource):
          
          resource_type = None
          xid = None
          if isinstance(resource, dict):
              resource_type = resource.get('type')
              xid = resource.get('xid')
          else:
              resource_type = resource.type
              xid = resource.xid
  
          if resource_type is not None and xid is not None:
              saved = True
              if resource_type in self.tcex.group_types:
                  try:
                      # groups
                      self.groups_shelf[xid] = resource
                  except Exception:
                      saved = False
  
                  if saved:
                      try:
                          del self._groups[xid]
                      except KeyError:
                          # if group was saved twice it would already be delete
                          pass
              elif resource_type in self.tcex.indicator_types_data.keys():
                  try:
                      # indicators
                      self.indicators_shelf[xid] = resource
                  except Exception:
                      saved = False
  
                  if saved:
                      try:
                          del self._indicators[xid]
                      except KeyError:
                          # if indicator was saved twice it would already be delete
                          pass
docs: Save group|indicator dict or object to shelve.
  
          Best effort to save group/indicator data to disk.  If for any reason the save fails
          the data will still be accessible from list in memory.
  
          Args:
              resource (dict|obj): The Group or Indicator dict or object.