There are times when it is really difficult to keep past things out of our mind. If it is about bad things others did to you and if it is something which can be compared as Reuben and other brothers roaming around free at their father's house when poor Joseph is in prison, then it gets tougher. Only revenge and wrong idea comes to your mind. You may feel helpless. If you find yourself in a similar situation then you need to remind yourself of the story of Joseph and decide that real forgiveness will allow safe passage to people even in your mind, even to those who did to you what Jacob did to Esau (deceived).
What should I do? If I am a child of God then I need to behave and react like Joseph and not like Cain. Sometimes this will require intentional prayer and seeking God's help.