The magnetocaloric effect at a first order phase transition