public async Task SetScenarios([FromBody] Scenarios input)
        {
            _connections.Set(input.ScenarioIds, input.ControllerId);
            var controller = _controllerRepository.Controllers.FirstOrDefault(x => x.Id == input.ControllerId);

            if (controller == null)
            {
                throw new Exception("Контроллер не найден");
            }
            await ControllerInfoSender.ListUpdateAsync(controller.Adress);

            _connections.SaveChanges();
        }
        public async Task DeleteScenario(long id)
        {
            if (User.Claims.FirstOrDefault(x => x.Type == ClaimsIdentity.DefaultRoleClaimType).Value ==
                Constants.RoleNames.SimpleUser)
            {
                throw new Exception("Не доступно простому пользователю");
            }
            var currentScenario = _scenarioRepository.Scenarios.FirstOrDefault(x => x.Id == id);

            if (currentScenario == null)
            {
                throw new Exception("Такого сценария не существует");
            }
            if (User.Claims.FirstOrDefault(x => x.Type == ClaimsIdentity.DefaultRoleClaimType).Value ==
                Constants.RoleNames.Admin)
            {
                _scenarioRepository.Delete(id);
                ;
                foreach (var controller in _connections.All.Include(x => x.Controller)
                         .Where(x => x.ScenarioId == id).Select(x => x.Controller))
                {
                    await ControllerInfoSender.DeleteAsync(controller.Adress, id);
                }
                _scenarioRepository.SaveChanges();
            }
            var children = _userGroupRepository.GetChildrenGroups(GetUserGroupId());

            if (children.Contains(currentScenario.UserGroupId))
            {
                _scenarioRepository.Delete(id);;
                foreach (var controller in _connections.All.Include(x => x.Controller)
                         .Where(x => x.ScenarioId == id).Select(x => x.Controller))
                {
                    await ControllerInfoSender.DeleteAsync(controller.Adress, id);
                }
                _scenarioRepository.SaveChanges();
            }
            else
            {
                throw new Exception("Этот сценарий вам не доступен");
            }
        }