download resource logic