public async Task <HostInfo> RegisterAsync(RegisterHostRequest request) { Validate.NotNull(request, nameof(request)); var provider = ResourceProvider.Get(request.Resource.ProviderId); var host = await hostService.FindAsync(provider, request.Resource.ResourceId);; if (host == null) { host = await hostService.RegisterAsync(request); } else { await TransitionStateAsync(host, request.Status);; } return(host); }