Saving many-to-one foreign keys.

- refactored m2o foreign key updating (issue #7)
- created tests for m2o
- changed how the (map) data is passed to the private methods (they were column-based initially, but changing them to entity-based makes more sense, especially since it enables foreign keys)