Removing session factory, re-arranging ORM code.