Update client.js

Adds a cleanup function on insert and update
Merge pull request #28 from mimah/master

AngularJS object cleanup before insert or update (FIX issue #27)