Fix checking if app exists before inserting into DB
I've managed to reproduce the exception locally and fixed the query to get if the app exists
I've test it by adding flask cli app create dashboard Dashboard
to run-app.sh
dashboard#64 (comment 46397)