You don’t mention what you need to get it out of!
This video may help https://www.youtube.com/watch?v=NzJjzWqxesc
With some of the Mira showers the solenoid is part of the flow valve, to replace the coil you have to remove the flow valve and in truth if you have to remove the flow valve you are just as well replacing the complete flow valve
This coil is used in a few showers so I don’t know which shower you are using it in.
However the most common reason for regular failure is water dripping down on top of the coil this can be very difficult to spot because the solenoid is warm the water dripping on to it dries immediately, but if you look carefully you can usually see a deposit on the coil that the water has left behind.