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);
            }
        }
        public static Models.WriteEffectiveAuthorizationEvent MapDomainToWriteStorageModel(Domain.EffectiveAuthorizationEvent effectiveAuthorizationEvent)
        {
            var eventType = effectiveAuthorizationEvent.GetType();

            if (eventType == typeof(Domain.EffectiveAuthorizationGrantedEvent))
            {
                return(Mapper.Map <Models.WriteEffectiveAuthorizationGrantedEvent>(effectiveAuthorizationEvent));
            }
            else if (eventType == typeof(Domain.EffectiveAuthorizationRevokedEvent))
            {
                return(Mapper.Map <Models.WriteEffectiveAuthorizationRevokedEvent>(effectiveAuthorizationEvent));
            }

            throw new NotImplementedException("Unrecognized Effective Authorisation Event");
        }