Can we move this function to utils/utils.go?