internal async Task <RemoteIssue> ToRemoteAsync(CancellationToken token) { var remote = new RemoteIssue() { assignee = this.Assignee, description = this.Description, environment = this.Environment, project = this.Project, reporter = this.Reporter, summary = this.Summary, votesData = this.Votes != null ? new RemoteVotes() { hasVoted = this.HasUserVoted == true, votes = this.Votes.Value } : null, duedate = this.DueDate }; remote.key = this.Key != null ? this.Key.Value : null; if (Status != null) { await Status.LoadIdAndNameAsync(_jira, token).ConfigureAwait(false); remote.status = new RemoteStatus() { id = Status.Id, name = Status.Name }; } if (Resolution != null) { await Resolution.LoadIdAndNameAsync(_jira, token).ConfigureAwait(false); remote.resolution = new RemoteResolution() { id = Resolution.Id, name = Resolution.Name }; } if (Priority != null) { await Priority.LoadIdAndNameAsync(_jira, token).ConfigureAwait(false); remote.priority = new RemotePriority() { id = Priority.Id, name = Priority.Name }; } if (Type != null) { await Type.LoadIdAndNameAsync(_jira, token).ConfigureAwait(false); remote.type = new RemoteIssueType() { id = Type.Id, name = Type.Name }; } if (this.AffectsVersions.Count > 0) { remote.affectsVersions = this.AffectsVersions.Select(v => v.RemoteVersion).ToArray(); } if (this.FixVersions.Count > 0) { remote.fixVersions = this.FixVersions.Select(v => v.RemoteVersion).ToArray(); } if (this.Components.Count > 0) { remote.components = this.Components.Select(c => c.RemoteComponent).ToArray(); } if (this.CustomFields.Count > 0) { remote.customFieldValues = this.CustomFields.Select(f => new RemoteCustomFieldValue() { customfieldId = f.Id, values = f.Values }).ToArray(); } if (this.Labels.Count > 0) { remote.labels = this.Labels.ToArray(); } return(remote); }