public async Task <Response <int> > Handle(SaveItemCommand request, CancellationToken cancellationToken) { var item = await _itemRepository.GetByCode(request.Code); if (item != null) { throw new ConflictException("This code is already registered!"); } var itemModel = _mapper.Map <Item>(request); itemModel.Active = true; await _itemRepository.AddAsync(itemModel); return(new Response <int>(itemModel.Id)); }