MODE-1853 Add checks to ensure DocumentEditor & ArrayEditor instances are stored

Added a few bits of logic to ensure that any DocumentEditor or ArrayEditor
(which wrap Document and Array objects) are not stored. There were a few
methods that might have been storing them.