Update resource.js

Make $save method check id field to call $create if it's undefined, or $update otherwise