private void deleteCommand(CommandLineApplication command) { var idOption = command.Option("-id", "Guid of the map entry", CommandOptionType.SingleValue); command.OnExecute(() => { if (!idOption.HasValue()) { command.Out.WriteLine("-id is required"); return(-1); } var map = _mapService.FindOneAsync(Guid.Parse(idOption.Value())).Result; if (map == null) { command.Out.WriteLine($"No map with id {idOption.Value()} found."); return(-1); } command.Out.WriteLine($"Deleting map {map.Id} (Description={map.Description}, IsBrowseable={map.IsBrowseable})"); _mapService.DeleteOneAsync(map.Id).Wait(); _imageService.DeleteOneAsync(map.ImageId).Wait(); return(0); }); }