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>
In case the upgrade is successful, it would be useful to print something like this:

    NOTE: If you are running Invenio 1 and Invenio 2 on top of the same database, 
    please use only Invenio 2 knowledge base administration interface from now on,
    in order to ensure data consistency.

You can add the same note to the commit log message.