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>
`models.KnwKB.query.filter_by(name=kb_name).exists().scalar()` return error:
```python
In [3]: KnwKB.query.filter_by(name="FAQ").exists().scalar()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-714a449c0637> in <module>()
----> 1 KnwKB.query.filter_by(name="FAQ").exists().scalar()

/home/vagrant/.virtualenvs/invenio2/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.pyc in __getattr__(self, key)
    660                     type(self).__name__,
    661                     type(self.comparator).__name__,
--> 662                     key)
    663             )
    664 

AttributeError: Neither 'Exists' object nor 'Comparator' object has an attribute 'scalar'
```