public async Task <DiscussionDto> AddDiscussion(CreateDiscussionDto createDiscussionDto, string body) { this.IsPending = true; try { if (this.SelectedProjectId == null) { throw new InvalidOperationException("SelectedProjectId is null"); } if (this.SelectedMergeRequestInternalId == null) { throw new InvalidOperationException("SelectedMergeRequestInternalId is null"); } using (var client = new GitLabClient(this.GitOptions)) { return(await client.AddDiscussion(this.GitOptions.SelectedProjectId.Value, this.SelectedMergeRequestInternalId.Value, createDiscussionDto, body)); } } catch (Exception ex) { this.errorService.AddError(ex); return(null); } finally { this.IsPending = false; } }