private void AddProfileScore(IXdbContext client, Contact contact) { if (string.IsNullOrWhiteSpace(tbProfileScore.Text) || string.IsNullOrWhiteSpace(tbProfileKeyId.Text) || string.IsNullOrWhiteSpace(tbProfileId.Text)) { return; } Guid profileId = Guid.Parse(tbProfileId.Text); Guid profileKeyId = Guid.Parse(tbProfileKeyId.Text); int score = int.Parse(tbProfileScore.Text, CultureInfo.CurrentCulture); var interaction = new Interaction(contact, InteractionInitiator.Brand, SystemChannelId, UserAgent); var engagementValueEvent = new Event(ProfileScoreChangeEventDefinitionId, DateTime.UtcNow); interaction.Events.Add(engagementValueEvent); client.AddInteraction(interaction); var profileScores = new ProfileScores(); var profileScore = new ProfileScore { Values = { [profileKeyId] = score } }; profileScores.Scores.Add(profileId, profileScore); client.SetProfileScores(interaction, profileScores); }