public function import(array $users = [])
{
$imported = 0;
$this->output->progressStart(count($users));
foreach ($users as $user) {
try {
// Import the user and retrieve it's model.
$model = $this->getModelFromAdldap($user);
// Save the returned model.
$this->save($user, $model);
if ($this->isDeleting()) {
$this->delete($user, $model);
}
$imported++;
} catch (\Exception $e) {
// Log the unsuccessful import.
if ($this->isLogging()) {
logger()->error("Unable to import user {$user->getCommonName()}. {$e->getMessage()}");
}
}
$this->output->progressAdvance();
}
$this->output->progressFinish();
return $imported;
}