OVT-8038: Optimized code element relation fetching by adding HashSet of Uris instead of looping ArrayList repeatedly. Added isEmpty-check for getLatestVersionNumbersForUris to prevent fetching of all relations.