Get rid of a double try-catch block in the Database class