code: func (r *Registry) AddReference(obj mo.Reference, field *[]types.ManagedObjectReference, ref types.ManagedObjectReference) {
  	r.WithLock(obj, func() {
  		if FindReference(*field, ref) == nil {
  			*field = append(*field, ref)
  		}
  	})
  }
docs: // AddReference appends ref to field if not already in the given field.