public async Task <PartModel> AddPartAsync(AddPartRequest request, CancellationToken cancellationToken)
        {
            var validator = new AddPartRequestValidator();
            await validator.ValidateAndThrowAsync(request, null, cancellationToken);

            if (await _partRepository.AnyAsync(x => x.Name == request.Name, cancellationToken))
            {
                throw new ServiceException(ErrorCodes.PartAlreadyExists, $"Part with given name already exists");
            }

            var partToAdd = new Part()
            {
                Name            = request.Name,
                Quantity        = request.Quantity,
                PartBoughtPrice = request.PartBoughtPrice
            };

            var result = await _partRepository.AddAsync(partToAdd, cancellationToken);

            return(_mapper.Map <PartModel>(result));
        }
        public async Task <IActionResult> AddPart([FromBody] AddPartRequest request, CancellationToken cancellationToken)
        {
            var result = await _partService.AddPartAsync(request, cancellationToken);

            return(Ok(result));
        }