Update samples to use attach/detach