Don’t Touch Me

Last night at chapel, I was listening to the brother expound on the resurrection of Christ and the appearance to Mary. The preaching sparked a thought that I had had in the past (and of course, which has been discussed to death in commentaries) but I wanted to put down some views on paper. Why did Christ tell Mary not to touch Him when later on in John 20 He’s telling Thomas to touch Him?