public override async Task <RequestResult <Guid> > Handle(RemoveMeasureCommand request, CancellationToken cancellationToken)
        {
            var measure = await _measuresRepository.GetMeasure(request.MeasureGuid);

            if (measure.IsBaseline)
            {
                throw new DomainException(ErrorCode.CantRemoveBaselineMeasure, new { request.MeasureGuid });
            }

            measure.Deactivate();
            await _measuresRepository.Save(measure);

            return(request.Success());
        }
        public override async Task <RequestResult <MeasureDto> > Handle(CreateMeasureCommand request, CancellationToken cancellationToken)
        {
            if (await _measuresRepository.IsNameTaken(request.Name))
            {
                throw new DomainException(ErrorCode.MeasureNameTaken, new { request.Name });
            }
            if (await _measuresRepository.IsSymbolTaken(request.Symbol))
            {
                throw new DomainException(ErrorCode.MeasureSymbolTaken, new { request.Symbol });
            }

            var measure = new Measure(_guid.GetGuid(), request.Name, request.Symbol, request.IsWeight, request.ValueInGrams);
            await _measuresRepository.Save(measure);

            return(request.Success(_mapper.Map <MeasureDto>(measure)));
        }