I finally came across Peter Martin's solution, which solves all of my needs quite nicely.
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.