code: def add2set(self, pid, key, value):
      
      prop = self.property_entries[pid]
  
      current = prop.objects.get(key, None)
      current_local_key = prop.references.get(key, None)
  
      if current and current is not value:
          current.detach()
  
      if current_local_key is None:
          prop.references[key] = prop.next_free_key
          prop.next_free_key += 1
  
      prop.objects[key] = value
  
      if prop.parent.dir:
          ref = prop.index_ref_name(key)
          dir_entry = prop.parent.dir.get(ref)
          if dir_entry is None:
              dir_entry = prop.parent.dir.makedir(ref)
          if value.dir != dir_entry:
              value.attach(dir_entry)
          prop.mark_modified()
docs: low level add to StrongRefSetProperty