But don't be upset, and don't be angry with yourselves for selling me to this place. It was God who sent me here ahead of you to preserve your lives. (Genesis 45:5 NLT) ...You intended to harm me, but God intended it all for good. He brought me to this position so I could save the lives of many people. (Genesis 50:20 NLT)
At the moment of a crisis it's hard to see how anything good can ever come from it. Only with the passing of time and a different perspective does it all begin to make sense. And, it may not be until eternity that you'll see the bigger picture and understand the mysterious ways of God. Like Joseph, there'll be a day when God makes His plan known and then you'll be glad you stayed faithful to Him even though, at the time, your circumstances were confusing and left you bewildered.