this needs to be updated since I just landed the changes on aerogear/aerogear-js-integration

another improvement would be to use a shallow clone (-depth 1)