Switching between one and two monitors When running my MBP, I attach an external monitor, a keyboard and trackpad to it so I have two separate desktops which are contiguous; like it's a "fancy" desktop. 

Back in the day on Mavericks, it behaved properly: when I unplugged the external monitor to, say, take the laptop into a meeting, it would just put all of the desktops separately on the built in display, roughly preserving which window stayed on which desktop so all you'd have to use was a run a restore tool like Display Maid to restore your window positions when you plug your external monitor back in. This was handy because you didn't have to manually clean up your desktop when done. 

Now, with El Cap, it would seem that when you unplug the external monitor, it used the monitor count of whichever screen had the most desktops and merges the windows from the two "combined desktops" into one desktop in a way that seemed to be random, which is clumsy. 

Worse, setting back Display Maid to restore the original configuration automatic doesn't work like it used to - previously it saved positions on all desktops in one action, but now it does it one screen at a time and forcing you restore eech desktop separately, which is tedious. It would seem that Display Maid is not great software anymore.

Is there some other utility out there that must work better so you can restore how your windows and desktop setup was as it was before you unplugged the external monitor. Any ideas?
I answered a very similar, though not a duplicate, question just the other day where the proposed solution would work for your as well.

Basically, the product you are looking for is Stay.