One can no more keep the mind from returning to an idea than the sea from returning to a shore. For a sailor, this is called the tide; in the case of the guilty it is called remorse. God stirs up the soul as well as the ocean.
Prophet Muhammad (peace be upon him) said: By his good character a believer will attain the degree of one who prays during the night and fasts during the day.
We should be careful to get out of an experience only the wisdom that is in it and stop there lest we be like the cat that sits down on a hot stove lid. She will never sit down on a hot stove lid again and that is well but also she will never sit down on a cold one anymore.