You're right, your first goal so be to stop reacting emotionally. It is very difficult. One thing I have seen a lot of marriage saving experts suggest is to suspend your facebook and other social media accounts. No good for much except following your W's every move on social media can come from them.
Anyway, some things to think about. As far as getting the affair out of your mind, it is tough. The best thing to do is to fill your time with as much brain engaging activities as possible. Brainless activities like driving, watching TV, etc will drive you nuts. If you can work a lot of hours, do it. I found that while I was engaged at work I could get it off of my mind.
M(53), W(54),D(19) M-23, T-25 Bomb Drop - Dec.23, 2017 Ring and Piecing since March 2018