if ($original_total !== $total) {
        if ($total > $original_total) {
            $diff = $total - $original_total;
        }
    }
    $total = 0;
    $diffApplied = false;
    foreach ($links as $link) {
        $weightToApply = $weight;
        if ($diffApplied == false) {
            if (!empty($diff)) {
                $weightToApply = $weight - $diff;
                $diffApplied = true;
            }
        }
        GradebookUtils::updateLinkWeight($link['id'], $link['resource_name'], $weightToApply);
    }
    foreach ($evaluations as $evaluation) {
        $weightToApply = $weight;
        if ($diffApplied == false) {
            if (!empty($diff)) {
                $weightToApply = $weight - $diff;
                $diffApplied = true;
            }
        }
        GradebookUtils::updateEvaluationWeight($evaluation['id'], $weightToApply);
    }
    header('Location:' . $currentUrl);
    exit;
}
// 	DISPLAY HEADERS AND MESSAGES