public Task <bool> Handle(DeleteCategoryCommand request, CancellationToken cancellationToken)
        {
            if (!request.IsValid())
            {
                NotifyValidationErrors(request);
                return(Task.FromResult(false));
            }
            _categoryRepository.Remove(request.Id);

            if (Commit())
            {
                Bus.RaiseEvent(new CategoryDeleteEvent(request.Id));
            }
            return(Task.FromResult(true));
        }
        public Task <bool> Handle(DeleteCategoryCommand request, CancellationToken cancellationToken)
        {
            if (!request.IsValid())
            {
                return(Task.FromResult(false));
            }

            _contactUnitOfWork.CategoriesRepository.DeleteCategory(request.UserId, request.Id);

            //Storing the deletion event
            if (_contactUnitOfWork.Commit())
            {
                _eventHandler.RaiseEvent(new CategoryDeletedEvent(request.Id));
            }

            return(Task.FromResult(true));
        }