Texture Object through If Node

Hello!

I’m fairly new to creating materials, but while experimenting, I encountered the “maximum samplers reached” error. To minimize the number of Texture Sampler nodes I’ve been using, I attempted to use Texture Objects instead. I have attached an image of both of my approaches, but as you can see, when passing a Texture Object node through an If Node and then into a Texture Sample, it doesn’t work.
Is there another method to achieve something similar? I considered using another Material which outputs a Texture, but I haven’t found a way to utilize the output in another Material.

Thanks in advance!
-azazel