Implement ApplyMask