public async Task ChangeLotUpdateInterval(string login, string updateInterval) { if (updateInterval == null) { throw new ArgumentNullException(nameof(updateInterval)); } var applicationUser = await unitOfWork.UserManager.FindByEmailAsync(login); if (applicationUser == null) { throw new NullReferenceException(nameof(applicationUser)); } logger.Info($"Change the time of lots update for {applicationUser.Email}"); if (applicationUser.EmailConfirmed) { if (updateInterval.Equals("None")) { logger.Info($"Remove scheduler and set lots update interval to null for {applicationUser.Email}"); applicationUser.LotUpdateInterval = null; schedulerManager.DeleteJob(applicationUser.Id); } else { var intUpdateInterval = Int32.Parse(updateInterval); logger.Info($"Update scheduler and set lots update interval to {intUpdateInterval} minutes for {applicationUser.Email}"); applicationUser.LotUpdateInterval = intUpdateInterval; schedulerManager.AddOrUpdateLotUpdateJob(applicationUser.Id, intUpdateInterval); } await unitOfWork.UserManager.UpdateAsync(applicationUser); } }