/// <summary>
        /// Relate this email result (presumed to represent me) in CRM to these related records.
        /// </summary>
        /// <param name="relatedRecords">The records which should be related to my email result.</param>
        /// <param name="emailResult">An email result (presumed to represent me).</param>
        private void LinkRelatedRecords(IEnumerable <CrmEntity> relatedRecords, RESTObjects.SetEntryResult emailResult)
        {
            var restServer = SuiteCRMUserSession.RestServer;

            foreach (CrmEntity record in relatedRecords)
            {
                try
                {
                    var success = RestAPIWrapper.TrySetRelationship(
                        new SetRelationshipParams
                    {
                        module2    = "emails",
                        module2_id = emailResult.id,
                        module1    = ModuleToTableResolver.GetTableName(record.ModuleName),
                        module1_id = record.EntityId,
                    }, Objective.Email);

                    if (success)
                    {
                        log.Debug($"Successfully bound {record.ModuleName} '{record.EntityId}' to email '{emailResult.id}' in CRM");
                    }
                    else
                    {
                        log.Warn($"Failed to bind {record.ModuleName} '{record.EntityId}' to email '{emailResult.id}' in CRM");
                    }
                }
                catch (Exception any)
                {
                    log.Error($"Failed to bind {record.ModuleName} '{record.EntityId}' to email '{emailResult.id}' in CRM", any);
                }
            }
        }
 /// <summary>
 /// Save my attachments to CRM, and relate them to this emailResult.
 /// </summary>
 /// <param name="emailResult">A result object obtained by archiving me to CRM.</param>
 private void SaveAttachments(RESTObjects.SetEntryResult emailResult)
 {
     foreach (ArchiveableAttachment attachment in Attachments)
     {
         try
         {
             BindAttachmentInCrm(emailResult.id,
                                 TransmitAttachmentPacket(ConstructAttachmentPacket(attachment)).id);
         }
         catch (Exception any)
         {
             log.Error($"Failed to bind attachment '{attachment.DisplayName}' to email '{emailResult.id}' in CRM", any);
         }
     }
 }