For every intention of the devil, God has a different conclusion. When the enemy thinks he has you, God will use the same set of circumstances to produce a different result. The devil thought he had Jesus. He did. The mistake was to allow Jesus into the lower parts of the earth. David, the Psalmist reports the eternal drama in Psa. 24:7-10. God is always ahead of the enemy. In this story Joseph states the divine intentions: God sent him ahead. If we knew why certain things happen, we would love God more and fear the devil less. It is why we have to walk by faith. This is Peters admonition to this kind of situations. ” So be truly glad. There is wonderful joy ahead, even though you must endure many trials for a little while. These trials will show that your faith is genuine. It is being tested as fire tests and purifies gold—though your faith is far more precious than mere gold. So when your faith remains strong through many trials, it will bring you much praise and glory and honor on the day when Jesus Christ is revealed to the whole world”.(1 Peter 1:6-7 NLT) Your time is coming. God is not demoting you. He’s preparing you a testimony.
Now therefore be not grieved, nor angry with yourselves, that ye sold me hither: for God did send me before you to preserve life. Genesis 45:5 KJV