public override async Task Run()
        {
            var feedText = ActivityUI.FeedTextSource.TextValue;

            if (string.IsNullOrEmpty(feedText))
            {
                throw new ActivityExecutionException("Can't post empty message to chatter");
            }
            if (!ActivityUI.UseUpstreamFeedParentIdOption.Selected && !ActivityUI.UseUserOrGroupOption.Selected)
            {
                throw new ActivityExecutionException("Feed parent Id value source is not specified");
            }
            var feedParentId = string.Empty;

            if (ActivityUI.UseUserOrGroupOption.Selected)
            {
                feedParentId = ActivityUI.UserOrGroupSelector.Value;
                if (string.IsNullOrEmpty(feedParentId))
                {
                    throw new ActivityExecutionException("User or group is not specified");
                }
            }
            if (ActivityUI.UseUpstreamFeedParentIdOption.Selected)
            {
                feedParentId = ActivityUI.FeedParentIdSource.TextValue;
                if (string.IsNullOrEmpty(feedParentId))
                {
                    throw new ActivityExecutionException("Upstream crates doesn't contain value for feed parent Id");
                }
            }
            var result = await _salesforceManager.PostToChatter(StripHTML(feedText), feedParentId, AuthorizationToken);

            if (string.IsNullOrEmpty(result))
            {
                throw new ActivityExecutionException("Failed to post to chatter due to Salesforce API error");
            }
            Payload.Add(Crate.FromContent(PostedFeedCrateLabel, new StandardPayloadDataCM(new KeyValueDTO("FeedID", result))));
        }
        public override async Task Run()
        {
            var feedText = FeedText;

            if (IsPostingToQueryiedChatter)
            {
                try
                {
                    var chatters = await _salesforceManager.Query(SelectedChatter.ToEnum <SalesforceObjectType>(),
                                                                  new[] { new FieldDTO("Id") },
                                                                  FilterConditionHelper.ParseConditionToText(JsonConvert.DeserializeObject <List <FilterConditionDTO> >(ChatterFilter)),
                                                                  AuthorizationToken);

                    var tasks = new List <Task <string> >(chatters.Table.Count);
                    foreach (var chatterId in chatters.DataRows.Select(x => x.Row[0].Cell.Value))
                    {
                        Logger.Info($"Posting message to chatter id: {chatterId}");

                        tasks.Add(_salesforceManager.PostToChatter(StripHTML(feedText), chatterId, AuthorizationToken).ContinueWith(x =>
                        {
                            Logger.Info($"Posting message to chatter succeded with feedId: {x.Result}");
                            return(x.Result);
                        }));
                    }
                    await Task.WhenAll(tasks);

                    //If we did not find any chatter object we don't fail activity execution but rather returns empty list and inform caller about it
                    if (!chatters.HasDataRows)
                    {
                        Logger.Info("No salesforce objects were found to use as chatter id.");
                        Success($"No {SelectedChatter} that satisfies specified conditions were found. No message were posted");
                    }
                    else
                    {
                        var resultPayload = new StandardPayloadDataCM();
                        resultPayload.PayloadObjects.AddRange(tasks.Select(x => new PayloadObjectDTO(new KeyValueDTO(FeedIdKeyName, x.Result))));
                        Payload.Add(Crate <StandardPayloadDataCM> .FromContent(PostedFeedCrateLabel, resultPayload));
                    }
                }
                catch (Exception ex)
                {
                    RaiseError(ex.Message);
                    return;
                }
            }
            else
            {
                var incomingChatterId = IncomingChatterId;
                if (string.IsNullOrWhiteSpace(incomingChatterId))
                {
                    throw new ActivityExecutionException("Upstream crates doesn't contain value for feed parent Id");
                }

                Logger.Info($"Posting message to chatter id: {incomingChatterId}");

                var feedId = await _salesforceManager.PostToChatter(StripHTML(feedText), incomingChatterId, AuthorizationToken);

                Logger.Info($"Posting message to chatter succeded with feedId: {feedId}");

                Payload.Add(Crate.FromContent(PostedFeedCrateLabel, new StandardPayloadDataCM(new KeyValueDTO(FeedIdKeyName, feedId))));
            }
        }