Create a contacts cache and move this logic there.