/// <summary>
        /// Uploads the document request did fail with error.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="error">The error.</param>
        public void UploadDocumentRequestDidFailWithError(UploadDocumentServerOperation request, Exception error)
        {
            if ((this.ApplicationRequest || this.RequestNr < 0) && this.RequestMode != UPOfflineRequestMode.OnlineOnly && error.IsConnectionOfflineError())
            {
                if (this.RequestNr < 0)
                {
                    this.StoreRequest(this.Storage.Database);
                }

                if (!this.Configuration.ConfigValueIsSet("Disable.77642"))
                {
                    this.Storage.BlockOnlineRecordRequest = true;
                }

                this.OfflineRequestDelegate?.OfflineRequestDidFinishWithResult(this, null, false, null, null);
                return;
            }

            if (!error.IsConnectionOfflineError() && string.IsNullOrEmpty(this.Error) && this.RequestNr >= 0)
            {
                this.ReportSyncError(error);
                this.UndoRecordsInCache(this.Records, UPCRMDataStore.DefaultStore);
            }

            this.OfflineRequestDelegate?.OfflineRequestDidFailWithError(this, null, null, error);
        }
        /// <summary>
        /// Uploads the document request did finish with json.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="json">The json.</param>
        public void UploadDocumentRequestDidFinishWithJSON(UploadDocumentServerOperation request, Dictionary <string, object> json)
        {
            List <object> jsonArray = json.Values.ToList();
            string        d1        = jsonArray[0] as string;
            List <object> syncInfos = jsonArray[2] as List <object>;

            UPCRMRecordSync.SyncRecordSetDefinitions(syncInfos);
            ResourceManager resourceManager = SmartbookResourceManager.DefaultResourceManager;
            Uri             url             = ServerSession.CurrentSession.DocumentRequestUrlForRecordIdentification(d1, request.FileName);
            string          localUrl        = resourceManager.LocalPathForResourceAtUrl(url, resourceManager.LocalPathForTransientResources, request.FileName);

            SimpleIoc.Default.GetInstance <IPlatformService>().StorageProvider.SaveFile(localUrl, request.Data);
            this.ReportSuccessfulSync();
            this.OfflineRequestDelegate?.OfflineRequestDidFinishWithResult(this, d1, true, null, json);
        }