SHARE THE MEMORY WITH GOD.
Joseph had painful memories that needed to be healed. A step he took was to share the painful memory of his brothers' sins with God. He had those memories available as we can see in his comments to the cupbearer in Genesis 40. "For I was forcibly carried off from the land of the Hebrews, and even here I have done nothing to deserve being put in a dungeon."
The Apostle Paul had many painful memories. Being beaten. Stoned. Shipwrecked. He shared those memories with God as well as with believers in Corinth. After sharing those memories with the Corinthian believers, he wrote about God's grace being sufficient (2 Cor. 11).
When I shared some painful memories with God, one of the first things He'd process in me were the damaged emotions associated with them. I sat down alone with God a number of times, asking Him to heal. The emotions sometimes had to be brought to the surface again so that unresolved aspects of the memory can be fully healed.
Joseph did this. He even became thankful for the memory! Later he told his brothers, "You intended to harm me, but God intended it to save our lives" (Genesis 50). He shared the memory with God who worked all things together for good for him.