/// <summary>
        /// This method Creates the Envelope and sends the envelope
        /// </summary>
        /// <param name="identity"></param>
        /// <param name="password"></param>
        /// <param name="subject"></param>
        /// <param name="emailBlurb"></param>
        /// <param name="file"></param>
        /// <param name="fileName"></param>
        /// <param name="recipients"></param>
        /// <returns></returns>
        public static string CreateEnvelope(Account identity, string password, string subject,
                                            string emailBlurb, byte[] file, string fileName, List <Recipient> recipients)
        {
            DocuSignAPI.APIService.Envelope envelope = new DocuSignAPI.APIService.Envelope();
            envelope.AccountId  = identity.AccountID;
            envelope.Subject    = subject;
            envelope.EmailBlurb = emailBlurb;

            //Populating Recipient Information

            envelope.Recipients = recipients.ToArray();

            //Populating Document information
            List <Document> documents = new List <Document>();
            Document        document  = new Document();

            document.Name     = fileName;
            document.PDFBytes = file;
            document.ID       = "1";
            documents.Add(document);
            envelope.Documents = documents.ToArray();

            APIServiceSoap apiService = CreateApiProxy(identity, password);
            EnvelopeStatus envStatus  = apiService.CreateAndSendEnvelope(envelope);

            return(envStatus.EnvelopeID);
        }
        /// <summary>
        /// This method creates an envelope and returns the url which could be embedded and used for the user signing process
        /// </summary>
        /// <param name="identity"></param>
        /// <param name="password"></param>
        /// <param name="subject"></param>
        /// <param name="emailBlurb"></param>
        /// <param name="file"></param>
        /// <param name="fileName"></param>
        /// <param name="recipients"></param>
        /// <param name="url"></param>
        /// <returns></returns>
        public static string CreateEmbedded(Account identity, string password, string subject,
                                            string emailBlurb, byte[] file, string fileName, List <Recipient> recipients, string url)
        {
            DocuSignAPI.APIService.Envelope envelope = new DocuSignAPI.APIService.Envelope();
            envelope.AccountId  = identity.AccountID;
            envelope.Subject    = subject;
            envelope.EmailBlurb = emailBlurb;

            //Populating Recipient Information
            envelope.Recipients = recipients.ToArray();

            //Populating Document information
            List <Document> documents = new List <Document>();
            Document        document  = new Document();

            document.Name     = fileName;
            document.PDFBytes = file;
            document.ID       = "1";
            documents.Add(document);
            envelope.Documents = documents.ToArray();

            APIServiceSoap apiService = CreateApiProxy(identity, password);
            EnvelopeStatus envStatus  = apiService.CreateAndSendEnvelope(envelope);

            RequestRecipientTokenAuthenticationAssertion assert = new RequestRecipientTokenAuthenticationAssertion();

            assert.AssertionID           = System.DateTime.Now.Ticks.ToString();
            assert.AuthenticationInstant = System.DateTime.Now;
            assert.AuthenticationMethod  = RequestRecipientTokenAuthenticationAssertionAuthenticationMethod.Password;
            assert.SecurityDomain        = "TODO-replace-with-your-app-name";

            string retUrl = url.ToLower();
            RequestRecipientTokenClientURLs clientURLs = new RequestRecipientTokenClientURLs();

            clientURLs.OnSigningComplete  = retUrl + "&event=SignComplete&envelopeID=" + envStatus.EnvelopeID;
            clientURLs.OnAccessCodeFailed = retUrl + "&event=AccessCode&envelopeID=" + envStatus.EnvelopeID;
            clientURLs.OnCancel           = retUrl + "&event=Cancel&envelopeID=" + envStatus.EnvelopeID;
            clientURLs.OnDecline          = retUrl + "&event=Decline&envelopeID=" + envStatus.EnvelopeID;
            clientURLs.OnException        = retUrl + "&event=Exception&envelopeID=" + envStatus.EnvelopeID;
            clientURLs.OnIdCheckFailed    = retUrl + "&event=IDCheck&envelopeID=" + envStatus.EnvelopeID;
            clientURLs.OnSessionTimeout   = retUrl + "&event=Timeout&envelopeID=" + envStatus.EnvelopeID;
            clientURLs.OnTTLExpired       = retUrl + "&event=TTLExpired&envelopeID=" + envStatus.EnvelopeID;
            clientURLs.OnViewingComplete  = retUrl + "&event=ViewComplete&envelopeID=" + envStatus.EnvelopeID;

            string token = apiService.RequestRecipientToken(envStatus.EnvelopeID, recipients[0].CaptiveInfo.ClientUserId, recipients[0].UserName, recipients[0].Email, assert, clientURLs);

            return(token);
        }