Refactored to get parent classes from ClassMetadata