public async Task <Unit> Handle(DeleteRfaCommand request, CancellationToken cancellationToken)
        {
            var rfaToRemove = await _repository.GetRfaByEmail(new Email(request.Email));

            if (rfaToRemove == null)
            {
                throw new NotFoundRfaException();
            }

            await _repository.Delete(rfaToRemove);

            return(new Unit());
        }
        public async Task <Unit> Handle(UpdateUserCommand request, CancellationToken cancellationToken)
        {
            var id            = new UserId(request.Id);
            var userToUpdated = await _repository.GetById(id);

            if (userToUpdated == null)
            {
                throw new UserNotFoundForUpdateException();
            }

            var role = await _roleRepository.GetRole(request.Role.Name);

            if (role == null)
            {
                throw new RoleNotFoundForUpdateUserException();
            }

            var email      = new Email(request.Email);
            var existEmail = await _repository.CheckMailExist(id, email);

            if (existEmail)
            {
                throw new EmailAlreadyAffectedException();
            }


            if (userToUpdated.Role.Name.Value == "rfa" && userToUpdated.Role.Name.Value != request.Role.Name)
            {
                // cas du changement de role quand l'ancien role est rfa
                var rfaToRemove = await _rfaRepository.GetRfaByEmail(userToUpdated.Email);

                if (rfaToRemove != null)
                {
                    await _rfaRepository.Delete(rfaToRemove);
                }
            }

            userToUpdated.UpdateFirstName(request.FirstName);
            userToUpdated.UpdateLastName(request.LastName);
            userToUpdated.UpdateEmail(request.Email);
            userToUpdated.UpdateRole(role);

            await _repository.Update(userToUpdated);



            return(new Unit());
        }