/// <inheritdoc/>
        public async Task AddSubscription(SubscriptionAddModel subscriptionModel)
        {
            if (await _subscriptionsRepositry.SubscriptionExists(subscriptionModel.Id) ||
                await _subscriptionsRepositry.SubscriptionExists(subscriptionModel.Event, subscriptionModel.Endpoint))
            {
                throw new DuplicateException();
            }

            var subscription = _mapper.Map <Subscription>(subscriptionModel);
            await _subscriptionsRepositry.AddSubscription(subscription);

            var endpoint = await _bus.GetSendEndpoint(typeof(ActivateSubscription).GetQueueAddress());

            await endpoint.Send(new ActivateSubscription(subscriptionModel.Id));

            await _unitOfWork.Save();
        }
        public async Task <IActionResult> AddSubscription(SubscriptionAddModel model)
        {
            await _subscriptionsService.AddSubscription(model);

            return(CreatedAtAction(nameof(GetSubscription), new { id = model.Id }, null));
        }