great refactoring in order to avoid problems with sqlalchemy and to eliminate code duplication in qt models