Optimization Based Scheme for Solving Richards' Equation