Fixes a bug: passed-in object value was modified

The passed in dict (can be document, stored procedure, trigger or other things) object should not be modified.