When a person comes into the knowledge of their wrongdoing, the thing for the person to do is to stop and admit that they have done wrong by repenting to God, and also repent to others if other people are involved. There are consequences for everything people do; whether it be good or bad. The longer a person carries the weight of their guilt; the load tends to get heavier, and then pride takes over making it hard for the person to go back to repent. It is simply a matter of being humble, and a person being totally honest with themself.
Jeremiah 31:19 says “Lord, after I wandered away from you, I changed my heart and life. After I understood, I beat my breast with sorrow. I was ashamed and disgraced, because I suffered for the foolish things I did when I was young.”
Be blessed, be encouraged, and have a great day.