public async Task InsertChannelEnterprise(ChannelEnterpriseDTO newChannelEnterprise)
        {
            ChannelEnterprise dbRecord = _mapper.Map <ChannelEnterprise>(newChannelEnterprise);

            await _unitOfWork.ChannelEnterpriseRepository.Add(dbRecord);

            await _unitOfWork.SaveAdministrationSwitchChangesAsync();
        }
        private async Task CreateChannelEnterpriseRecord(Channel dbRecord, ChannelDTO channelDTO)
        {
            var newChannelEnterprise = new ChannelEnterprise
            {
                IDChannel    = dbRecord.IDChannel,
                IDEnterprise = channelDTO.EnterpriseID,
                Status       = true
            };

            await _unitOfWork.ChannelEnterpriseRepository.Add(newChannelEnterprise);
        }
        public async Task DeleteChannelEnterprise(int id)
        {
            ChannelEnterprise existingRecord = await _unitOfWork.ChannelEnterpriseRepository.GetById(id);

            if (existingRecord == null)
            {
                throw new ValidationException("Registro no existe para el ID proporcionado.");
            }

            await _unitOfWork.ChannelEnterpriseRepository.Delete(id);

            await _unitOfWork.SaveAdministrationSwitchChangesAsync();
        }
        public async Task <bool> UpdateChannelEnterprise(ChannelEnterpriseDTO channelEnterpriseDTO)
        {
            ChannelEnterprise existingRecord = await _unitOfWork.ChannelEnterpriseRepository.GetById(channelEnterpriseDTO.Id);

            if (existingRecord == null)
            {
                throw new ValidationException("Registro no existe para el ID proporcionado.");
            }


            var updatedRecord = _mapper.Map <ChannelEnterprise>(channelEnterpriseDTO);

            _unitOfWork.ChannelEnterpriseRepository.Update(existingRecord, updatedRecord);

            await _unitOfWork.SaveAdministrationSwitchChangesAsync();

            return(true);
        }