NOJIRA Make sure the md element set cache is flushed for the whole set if something changes.

Previously, we would only flush the parent_id which could cause
problems in nested containers.