public IActionResult Edit(EditCustomerDto customerDto)
        {
            List <CustomerTypeCustomer> entitiesToAdd = new List <CustomerTypeCustomer>();

            if (customerDto.CustomerTypeIds != null)
            {
                foreach (int customerTypeId in customerDto.CustomerTypeIds)
                {
                    entitiesToAdd.Add(new CustomerTypeCustomer {
                        CustomerTypeId = customerTypeId, CustomerId = customerDto.Id
                    });
                }
            }

            if (ModelState.IsValid)
            {
                _customerTypeCustomerRepository.DeleteAllTTypes(x => x.CustomerId == customerDto.Id);
                entitiesToAdd.ForEach(x => { _customerTypeCustomerRepository.Add(x); });

                Customer customer = _mapper.Map <Customer>(customerDto);

                _customerRepository.Update(customer);
                return(RedirectToAction("Index"));
            }

            customerDto.CustomerTypes = entitiesToAdd;
            TempData["CustomerTypes"] = _customerTypes;
            return(View(customerDto));
        }