code: func (u *PubAndHashUpdates) ApplyWriteSet(txRWSet *rwsetutil.TxRwSet, txHeight *version.Height, db privacyenabledstate.DB) error {
  	txops, err := prepareTxOps(txRWSet, txHeight, u, db)
  	logger.Debugf("txops=%#v", txops)
  	if err != nil {
  		return err
  	}
  	for compositeKey, keyops := range txops {
  		if compositeKey.coll == "" {
  			ns, key := compositeKey.ns, compositeKey.key
  			if keyops.isDelete() {
  				u.PubUpdates.Delete(ns, key, txHeight)
  			} else {
  				u.PubUpdates.PutValAndMetadata(ns, key, keyops.value, keyops.metadata, txHeight)
  			}
  		} else {
  			ns, coll, keyHash := compositeKey.ns, compositeKey.coll, []byte(compositeKey.key)
  			if keyops.isDelete() {
  				u.HashUpdates.Delete(ns, coll, keyHash, txHeight)
  			} else {
  				u.HashUpdates.PutValHashAndMetadata(ns, coll, keyHash, keyops.value, keyops.metadata, txHeight)
  			}
  		}
  	}
  	return nil
  }
docs: // ApplyWriteSet adds (or deletes) the key/values present in the write set to the PubAndHashUpdates