It seems to me that you can have an intermediary variable |var download = DownloadItem.getDownload(id);| and then use it for this case and the previous.