On adjudging the rescission of a contract, the court may require the party to whom such relief is granted to restore, so far as may be, any benefit which he may have received from the other party and to make any compensation to him which justice may require.