remove stale resource data before updating with new data

If you don't remove stale data then after updating you will have some key/value pairs that no longer exist and didn't come from server. Fox example, after resource.destroy() server doesn't return `id`, but on the client resource still has the old one.

Code in commit is not for production, but for demonstration purposes only.