Have you looked at this thread?
It’s not a perfect fit for your situation, but might get you onto the right track.