saving state befor mongoose