updated tests, refactored a bunch of stuff, wrote resourceToModel().
Merge branch 'feature/transactions' of github.com:openeyes/OpenEyes into feature/transactions