public async Task <INodeResult> CreateNode( [Required][MaxLength(255)] string name, [Required][MaxLength(255)] string host, [Required][MaxLength(255)] string username, [Required][Range(1, 65535)] int port, string?password, string?privateKey, [GlobalState("ClaimsPrincipal")] ClaimsPrincipal user ) { var tenant = user.Tenant(); try { var id = await nodeService.Create(tenant, name, new NodeCredentials(host, username, port, password, privateKey)); return(await ctxFactiry.CreateDbContext().Nodes.Where(x => x.Id == id) .Select(x => new SuccessfulNodeCreation { Node = x }).FirstAsync()); } catch (NodeConnectionFailedException ex) { return(NodeConnectionFailed.FromNodeConnectionFailedException(ex)); } }