public Task <List <Domain.EffectiveAuthorizationEvent> > GetRawEventsAsync(
            Domain.EffectiveAuthorization effectiveAuthorization)
        {
            try
            {
                //The reason for composing the full SQL statement instead of using the Equals operation as part of a linq "where" is because "Equals" operator is not supported
                var resourceResponse = _client.CreateDocumentQuery <Models.ReadEffectiveAuthorizationEvent>(
                    UriFactory.CreateDocumentCollectionUri(_dbConfig.Database, _dbConfig.Collection),
                    GetSQLQueryByEffectiveAuthorisation(effectiveAuthorization), _queryOptions).ToList();

                // can't filter event with null target in cosmos db, so doing the event with target null filter here.
                if (effectiveAuthorization.Target is null)
                {
                    resourceResponse = resourceResponse.Where(e => e.EffectiveAuthorization.Target is null).ToList();
                }

                var output = new List <Domain.EffectiveAuthorizationEvent>();
                foreach (Models.ReadEffectiveAuthorizationEvent readModelEvent in resourceResponse)
                {
                    output.Add(DomainAdapter.MapReadStorageModelToDomain(readModelEvent));
                }

                return(Task.FromResult <List <Domain.EffectiveAuthorizationEvent> >(output));
            }
            catch (RawEventStorageException ex)
            {
                throw new RawEventStorageException($"Issue while reading events from the storage account :{ex.Message}",
                                                   ex);
            }
        }
        public async Task <string> WriteRawEventAsync(Domain.EffectiveAuthorizationEvent effectiveAuthorizationEvent)
        {
            var effectiveAuthorizationEventModel = DomainAdapter.MapDomainToWriteStorageModel(effectiveAuthorizationEvent);

            try
            {
                var resourceResponse = await _client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(_dbConfig.Database, _dbConfig.Collection), effectiveAuthorizationEventModel);

                return(resourceResponse.Resource.Id);
            }
            catch (Exception e) {
                throw new RawEventStorageException($"Storage failure causes process interruption due to :{e.Message}", e);
            }
        }