Hi. I offered a solution to this in two other threads.
This one will lead you to the other one Try reading through it and you should be able to figure it out. If you have some issue let me know and I will look into it, but solution is pretty much in copy/paste state, so you should be fine. At the end of the thread posted bellow you will find working playground where I implemented the solution, in the thread linked to thread bellow you will find step by step explanation (hopefully) on what’s going on.
@sebavan What do you think about putting this into a out-of-box method into code base, as it is becoming a recurring question and it might be useful to have it. I can try to create a PR for it in couple of days when I find time.