Lagrangian form of stochastic equations and quantum theory