Refactoring metadata CRUD