Refractor Metadata custom path handling to avoid too many if conditions