Add a AbstractMetadataRepository to remove duplicated code