Use type converted data when writing back to database.

This allows foreignKey types and other custom types
to be converted into natvie values before writing them
to the database.
Move new var into thunk.

There really was no reason for it to be in the
outer context.
Add unit test for datatype handling in updateAttributes.
Merge branch 'partial-fix-for-58' of github.com:arlaneenalra/loopback-datasource-juggler
Simplify the test case