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 tag 'v1.3.1'

1.3.1
Merge branch 'partial-fix-for-58' of github.com:arlaneenalra/loopback-datasource-juggler
Simplify the test case
Bump version
Merge branch 'release/1.3.2' into production