There is an entire topic, with examples here. If you are also using unbound, look at my solution here.