$generalSubject->save();
    $generalSubjectID = $generalSubject->primaryKey;
    $detailSubjectArray = array();
    $detailSubjectArray = explode(':::', $_POST['detailSubjectsList']);
    $detailSubjectIDs = "(-1";
    // Update the GeneralDetailSubject Links
    foreach ($detailSubjectArray as $key => $value) {
        if ($value) {
            $generalDetailSubjectLink = new GeneralDetailSubjectLink();
            $generalDetailSubjectLink->detailedSubjectID = $value;
            $generalDetailSubjectLink->generalSubjectID = $generalSubjectID;
            // Add any Detail Subject Links that are new
            if ($generalDetailSubjectLink->duplicateCheck() == 0) {
                // Add the new link
                try {
                    $generalDetailSubjectLink->save();
                } catch (Exception $e) {
                    echo $e->getMessage();
                }
            }
            // Build list of detailid's that are in use
            $detailSubjectIDs = $detailSubjectIDs . ', ' . $value;
        }
    }
    $detailSubjectIDs = $detailSubjectIDs . ')';
    $generalDetailSubjectLink = new GeneralDetailSubjectLink();
    // Delete the links that are no longer in use.
    $generalDetailSubjectLink->deleteNotInuse($generalSubjectID, $detailSubjectIDs);
} catch (Exception $e) {
    echo $e->getMessage();
}