public async Task <EnqueuePositionResult> AddToQueue(EnqueuePosition item) { if (item is null) { throw new ArgumentNullException(nameof(item)); } CurrentQueueNumber currentNumber = await _repository.GetCurrentNumber(item.ServiceType); currentNumber.NextNumber++; await _repository.UpadteNextNumber(currentNumber, item.ServiceType); QueueItem newItem = new QueueItem() { UserID = item.UserID, UserNumber = currentNumber.NextNumber }; await _repository.AddItem(item.ServiceType, newItem); return(new EnqueuePositionResult { UserNumber = newItem.UserNumber }); }