Fix analyzer warnings
Add an exception in case of unknown button
Cleanup and refactor the DatabaseDocument