The stochastic energy-Casimir method