moving retry function to common utils file