code: func (m *MACCommands) UnmarshalBinary(data []byte) error {
  	var pLen int
  	for i := 0; i < len(data); i++ {
  		if _, s, err := lorawan.GetMACPayloadAndSize(false, lorawan.CID(data[i])); err != nil {
  			pLen = 0
  		} else {
  			pLen = s
  		}
  
  		// check if the remaining bytes are >= CID byte + payload size
  		if len(data[i:]) < pLen+1 {
  			return errors.New("not enough remaining bytes")
  		}
  
  		var mc lorawan.MACCommand
  		if err := mc.UnmarshalBinary(false, data[i:i+1+pLen]); err != nil {
  			return err
  		}
  		*m = append(*m, mc)
  		i += pLen
  	}
  	return nil
  }
docs: // UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.