AFAIK, CiviCRM can’t do this natively, as you can see in that question. I’m facing the same problem, I will try to solve it by doing an extension.
Update (2017-11-20)
I’ve started to work on a patch for CiviCRM. The work-in-progress PR is available here. Comments are welcome ;)
Olivier;