Adds factory and tests for the affiliation model.

Also modified the way work_string was set up so that it has been moved into a helper and primary_organization
and primary_title were moved into the user model. Fixes #587. Fixes #563.