{
    $db->commit();
    $script->shutdown( 0, 'No user logs to process. Script will shutdown' );
}
foreach ( $queryResult as $row )
{
    $userActionLog = new UserActionLog( $row );
    $changeMade = $userActionLog->getChange();
    $applicationLocalizedId = $changeMade['application_localized_id'];
    $publisherFolderId = $changeMade['publisher_folder_id'];
    $cli->output( "Aligning application localized {$applicationLocalizedId} with publisher {$publisherFolderId}" );

    try
    {
        alignApplicationWithPublisherFolder( $applicationLocalizedId, $publisherFolderId, $cli );
        $userActionLog->setDoneByEnvironmentCode( $env );
    }
    catch ( Exception $e )
    {
        $cli->error( $e->getMessage() );
        $userActionLog->Done = UserActionLog::STATUS_PROCESSED_ERROR;
    }

    updateUserActionLogDoneStatus( $db, $userActionLog );
    $cli->output( "Updated user action log {$userActionLog->Id} - `done` set to {$userActionLog->Done}." );
}

$db->commit();
$script->shutdown();

/**