public async Task <Item> AddRandomItemToMonsterAsync(NaheulbookExecutionContext executionContext, int monsterId, CreateRandomItemRequest request) { using (var uow = _unitOfWorkFactory.CreateUnitOfWork()) { var monster = await uow.Monsters.GetAsync(monsterId); if (monster == null) { throw new MonsterNotFoundException(monsterId); } var group = await uow.Groups.GetGroupsWithCharactersAsync(monster.GroupId); if (group == null) { throw new GroupNotFoundException(monster.GroupId); } _authorizationUtil.EnsureIsGroupOwner(executionContext, monster.Group); } var item = await _itemService.AddRandomItemToAsync(ItemOwnerType.Monster, monsterId, request, executionContext.UserId); var session = _notificationSessionFactory.CreateSession(); session.NotifyMonsterAddItem(monsterId, item); await session.CommitAsync(); return(item); }