continue refactoring, move SQLAlchemy related code from views into models to hide model implementation details, better utilize model relationships to enable application features, add more tests, all tests pass