You should note that this only removes the metadata field if it is empty.  This is an important fact that might not be obvious when looking at this method.