VID-1815 Move checking logic into ApiService::foreignCall