I've created a TOC with a lot of help but in the end what I am doing is creating a layer based on some filters. So what I want to do is add the layer with the filters and then if someone runs it again it removes the old layer and adds a new layer with the same name but with the new filters.
Where I am having problems is removing the layer out of the Table of Contents. So if you click on my example below and click the get results button twice you will see that my "StoresResultsLayer" is showing twice. I only want it to show once. So how do you remove a layer from the TOC?