Refactored the logic for charm get relation data