Extract mergeQuery and setScopeValuesFromWhere

Related to #274 - in preparation of default scope
Implemented collection setting for Memory connector
Properly reset Memory connector cache on automigrate
Full test CRUD suite for default scope
Allow default scope to be a function
Test default scope with relations
applyProperties => properties (object/false)
Cleanup, consistency: allow properties to be a function

Also, pass along the current instance, for any instance method as a
context (save, updateAttributes).
Allow `attributes` as an alias for `properties` (for LDL)