/// <summary>
        /// Attempt to save me given these related records and this HTML body, taking note of these previous failures.
        /// </summary>
        /// <param name="relatedRecords">CRM module names/ids of records to which I should be related.</param>
        /// <param name="fails">Any previous failures in attempting to save me.</param>
        /// <returns>An archive result object describing the outcome of this attempt.</returns>
        private ArchiveResult TrySave(IEnumerable <CrmEntity> relatedRecords, Exception[] fails)
        {
            CrmRestServer  restServer  = SuiteCRMUserSession.RestServer;
            SetEntryResult emailResult = restServer.GetCrmResponse <RESTObjects.SetEntryResult>("set_entry",
                                                                                                ConstructPacket(this.HTMLBody));
            ArchiveResult result = ArchiveResult.Success(emailResult.id, fails);

            if (result.IsSuccess)
            {
                LinkRelatedRecords(relatedRecords, emailResult);
                SaveAttachments(emailResult);
            }

            return(result);
        }
 public WithRestServiceTests()
 {
     this.server = new CrmRestServer(this.Log, 30000);
 }