refactor getNamespace and implement MediaResource