How then could I do such a wicked thing and sin against God?
Genesis chapter 39

Joseph, who was sold as a slave by his jealous brothers, starts to serve at the house of Potiphar, the captain of the guard in Egypt. God is with Joseph and he prospers. Potiphar sees that, and makes Joseph his attendant; he puts Joseph in charge of his household and entrusts to his care everything he owns. So, God blesses the household of the Egyptian because of Joseph.
Joseph is faithfully taking care of his master’s family. One day, however, he faces trouble. Potiphar’s wife takes notice of Joseph and keeps speaking to him. But Joseph refuses, saying, “How then could I do such a wicked thing and sin against God?” After his refusal, Potiphar’s wife gets angry and calls the people and frames him.
To keep his faith and conscience clear, Joseph is imprisoned. Even in prison, God is with Joseph and he prospers. Joseph is trusted by the prison warden and he is made responsible for all that is done there afterwards. Later on, he is set free to become the prime minister of Egypt.
The irony of fate means our life fortune is hard to predict because it has a wide variation; an evil may sometimes turn out to be a blessing in disguise.
That’s how Joseph’s life was. He was sold as a slave because of his brothers. He thought he was finally settling on an unfamiliar land but got framed and was sent to prison. Although his life was changeable where he couldn’t count on the following day, there was something that never changed in his life: It was his heart toward God. Joseph never forgot that God was always with him.
Trials can come your way even if you live a righteous and honest life in God. And if you get under control by the pain and suffering from it, you get a sense of loss and helplessness deep inside your heart. Because of that, sometimes your heart tells you to live however you want, forgetting everything.
If you are facing with trial, there is only one thing to remember: God is with you even at this moment. The harder situation you are in, get farther from sinful acts. If you keep your faith and conscience clear and follow the truth faithfully, God will finally open the way of prosperity just as God rescued Joseph the righteous, made him the prime minister of Egypt, and gave him the happiness of meeting his family again (Genesis 46:29–30).