to use or change a bad situation so that it helps you
turn sth to your advantage
Definitions from the Oxford Advanced Learner's Dictionary, 9th edition