turn something over in your mind
turn (something) over in (one's) mind
To think about something continuously; to give something one's close and undivided attention. I've been turning over the problem in my mind for days, but I still haven't figured out a way to make the numbers work. You're going to drive yourself crazy if you keep turning over that encounter in your mind—you just have to let it go.