knowledge: API migration to SQLAlchemy

* Replaces run_sql queries with SQLAchemy query.

* Refactors module in order to move logic from api to model.

Signed-off-by: Leonardo Rossi <leonardo.r@cern.ch>
It's not a blocker at all, but for next time take a look at the `session_manager` decorator in `invenio.ext.sqlalchemy.utils` that can do the commit/rollback for you. 

See: https://github.com/inveniosoftware/invenio/blob/pu/invenio/ext/sqlalchemy/utils.py#L116