Refactor code to do all changes in metadata on metadataFromRepresentation method.