restructure the code in ClerkController.java
refactor DialogHelper to make it simpler