public async Task <CommandResponse <Guid> > Handle(BusinessDeleteCommand request, CancellationToken cancellationToken)
            {
                var result = new CommandResponse <Guid>()
                {
                    Errors = GetRequestErrors(request)
                };

                if (result.Errors.Count == 0)
                {
                    try
                    {
                        var aggregate = new AssociateAggregate(_dbContext);
                        await aggregate.BusinessDeleteAsync(request.Key);

                        result.Result = request.Key;
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);

                        result.ErrorInfo = new ErrorInfo()
                        {
                            UserErrorMessage = "An internal error has occured",
                            HasException     = true
                        };
                    }
                }
                return(result);
            }
            private List <KeyValuePair <string, string> > GetRequestErrors(BusinessDeleteCommand request)
            {
                var issues = _validator.Validate(request.Key).Errors;

                foreach (var issue in issues)
                {
                    _errors.Add(new KeyValuePair <string, string>(issue.PropertyName, issue.ErrorMessage));
                }
                return(_errors);
            }
        public async Task <ActionResult> DeleteBusiness(Guid key)
        {
            var command     = new BusinessDeleteCommand(key);
            var cmdResponse = await Mediator.Send(command);

            if (cmdResponse.Errors.Any())
            {
                return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status400BadRequest, cmdResponse));
            }

            if (cmdResponse.ErrorInfo.HasException)
            {
                return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status500InternalServerError, cmdResponse));
            }

            return(new OkResult());
        }