public IActionResult PutMultiFactorMine(Guid id, PutMultiFactorParam param)
        {
            var multiFactor = _userRepository.GetMultiFactor(id);
            var user        = _userRepository.GetEndUser(Guid.Parse(User.Identity.Name));

            if (multiFactor.EndUser.Domain.OrganizationCode != user.Domain.Organization.Code)
            {
                ModelState.AddModelError("Role", Messages.InvalidRole);
                return(ValidationProblem(modelStateDictionary: ModelState, statusCode: StatusCodes.Status403Forbidden));
            }
            return(PutMultiFactor(id, param));
        }
        public IActionResult PutMultiFactor(Guid id, PutMultiFactorParam param)
        {
            var multiFactor     = _userRepository.GetMultiFactor(id);
            var availablePeriod = multiFactor.EndUser.AvailablePeriods.OrderByDescending(a => a.StartDate).FirstOrDefault();

            if (param.StartDate < multiFactor.SimAndDevice.StartDate || param.StartDate > multiFactor.SimAndDevice.EndDate || availablePeriod?.StartDate > param.StartDate || availablePeriod?.EndDate < param.StartDate)
            {
                ModelState.AddModelError(nameof(param.StartDate), Messages.OutOfDate);
            }
            if (param.EndDate < multiFactor.SimAndDevice.StartDate || param.EndDate > multiFactor.SimAndDevice.EndDate || availablePeriod?.StartDate > param.EndDate || availablePeriod?.EndDate < param.EndDate)
            {
                ModelState.AddModelError(nameof(param.EndDate), Messages.OutOfDate);
            }
            if (!ModelState.IsValid)
            {
                return(ValidationProblem(ModelState));
            }

            multiFactor.StartDate  = (DateTime)param.StartDate;
            multiFactor.EndDate    = param.EndDate;
            multiFactor.ClosedNwIp = param.ClosedNwIp;
            _userRepository.Update(multiFactor);
            return(Ok(multiFactor));
        }