private OfficeDocumentStore()
 {
     _identityServerUmaClientFactory = new IdentityServerUmaClientFactory();
     _identityServerClientFactory    = new IdentityServerClientFactory();
     _documentManagementFactory      = new DocumentManagementFactory();
     _accessTokenStore    = AccessTokenStore.Instance();
     _authenticationStore = AuthenticationStore.Instance();
     _tokens    = new List <StoredUmaAccessToken>();
     _documents = new List <StoredOfficeDocument>();
 }
        public async Task <string> GetUmaResourceId(string documentId)
        {
            var document = _documents.FirstOrDefault(d => d.DocumentId == documentId);

            if (document != null)
            {
                return(document.UmaResourceId);
            }

            var getDocumentResponse = await _documentManagementFactory.GetOfficeDocumentClient().GetResolve(documentId, Constants.DocumentApiConfiguration, AuthenticationStore.Instance().AccessToken).ConfigureAwait(false);

            _documents.Add(new StoredOfficeDocument
            {
                DocumentId    = documentId,
                UmaResourceId = getDocumentResponse.OfficeDocument.UmaResourceId
            });

            return(getDocumentResponse.OfficeDocument.UmaResourceId);
        }