Some SQLAlchemy session cleanup

Rebuilt #93 on development, then split out the plugin part.

This is the session handling cleanup. The point is to abstract any session
management away from the endpoints are using the data, and to
initiate a session per transaction rather than leaving one session open
for the lifetime of the server (the latter was causing concurrency issues
when different factories were accessing the session).
Fix for plugin_storage
Merge pull request #98 from slitherrr/cleanup-sqlalchemy_sessions

Some SQLAlchemy session cleanup