public void Scan() { var website = WebsiteRepository.GetNextScanTargets(1).FirstOrDefault(); if (website == null) { throw new NoWebsiteException(); } var scan = ScanService.TriggerScan(website.Hostname); scan.Wait(); ScanRepository.AddWebsiteToScan(scan.Result, website.Id); WebsiteRepository.UpdateLastScanDateToNow(website.Id); }