How to change the object of an activation track in Timeline

I have looked at many “answers” to similar questions , but nothing seems to work for my problem.
I have a playable director on a GameObject. When a player picks the object up, I want to start a timeline which does an animation clip (this works fine), but also deactivates the object. Obviously I could set the object in the editor, but I want to leave it blank, so that the same timeline can be used for multiple objects.

So, when I am about to Play() the timeline, I want to check if the sourceObject is null, and if so, replace it with the ‘this’ object.

I understand that I need to call SetGeneticBinding.key(key, value), but i can’t find the first argument (key).
I believe I can get there by using

 TimelineAsset timelineAsset = (TimelineAsset) playableDirector.playableAsset;

but what next? I have found an answer using

`(TrackAsset) timelineAsset.outputs*.sourceObject`*

but you can’t index outputs that way.`

Error CS0021 Cannot apply indexing with [] to an expression of type 'IEnumerable
`

I have (possibly) stumbled across the answer. This seems to work for me.

  if (playableDirector != null)
            {
                TimelineAsset timelineAsset = (TimelineAsset)playableDirector.playableAsset;
                foreach (PlayableBinding output in timelineAsset.outputs)
                {
                   if (output.streamName == "Activation Track")
                    {
                        playableDirector.SetGenericBinding(output.sourceObject,this.gameObject);
                    }
                }
                 playableDirector.Play();
            }

Your mileage may vary.