public PreCacheDocumentResponse PreCacheDocument(PreCacheDocumentRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            string passToCheck = ServiceHelper.GetSettingValue(ServiceHelper.Key_Access_Passcode);

            if (!string.IsNullOrWhiteSpace(passToCheck) && request.Passcode != passToCheck)
            {
                throw new ServiceException("Document cannot be pre-cached - passcode is incorrect", HttpStatusCode.Unauthorized);
            }

            if (request.Uri == null)
            {
                throw new ArgumentException("uri must be specified");
            }

            ServiceHelper.CheckUriScheme(request.Uri);

            if (!PreCacheHelper.PreCacheExists)
            {
                // Return an empty item
                return(new PreCacheDocumentResponse());
            }

            var cache = ServiceHelper.Cache;

            // Get the cache options, if none, use All (means if the user did not pass a value, we will cache everything in the document)
            if (request.CacheOptions == DocumentCacheOptions.None)
            {
                request.CacheOptions = DocumentCacheOptions.All;
            }

            return(PreCacheHelper.AddDocument(cache, request));
        }