add method to clear the state of the dialog.