public IHttpActionResult DomainAvailable(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException($"{nameof(name)} is null or empty");
            }

            var existingDomain = _domainService.GetDomainByName(name);

            if (existingDomain != null || _workflowCompanyActivityService.IsDomainBeingCreated(name))
            {
                return(Ok(false));
            }

            return(Ok(true));
        }
        public async Task Consume(ConsumeContext <ICreateCompanyCommand> context)
        {
            if (!context.Message.Company.Domains.Any())
            {
                throw new ArgumentException(nameof(context.Message.Company.Domains));
            }

            if (context.Message.Company.Domains.Select(domain => _domainService.IsDomainAvailable(domain.Name)).Any(isDomainAvailable => !isDomainAvailable))
            {
                throw new Exception("Domain already taken!");
            }

            //TODO: Accept IEnumerable<string>
            if (_workflowCompanyActivityService.IsDomainBeingCreated(context.Message.Company.Domains.ToList()))
            {
                throw new Exception("One of the domains is being used already!");
            }

            await _createCompanyWorkflowBuilder.Execute(context);
        }