Refactor upload cast method to helper