Import sentinel properly
Rebuild db
Refactor
Rollback db session when an exception occurs
Rollback session only for SQLAlchemy exceptions.
Refactor tests
Refactor tests.

NOTE: this commit has refactor also the way we interact with the db object, as
Flask-SQLAlchemy closes the session after a request has been done, so if you
use something like app = db.session.query(App).first and you do after that
a proper Flask request, the object will not be bound to the session anymore.
Refactor
Refactor
Refactor
Refactor
Remove db as it is not used.