Minor refacturing on common code for dialogs