moving the remaining database code from MainWin to DatabaseLog