Snall refactor: extract a duplicated function in MetadataTag helper