public void updateProfile( Profile p ) {

		ArrayList<AchievementRecord> newAchRecs = new ArrayList<AchievementRecord>();
		newAchRecs.addAll( p.getAchievements() );

		for ( Map.Entry<Achievement, JCheckBox> entry : shipAchBoxes.entrySet() ) {
			String achId = entry.getKey().getId();
			JCheckBox box = entry.getValue();
			if ( box.isSelected() ) {
				// Add selected achievement recs if not already present.
				if ( !AchievementRecord.listContainsId( newAchRecs, achId ) ) {
					newAchRecs.add( new AchievementRecord(achId, difficulty) );
				}
			} else {
				// Remove achievement recs that are not selected.
				AchievementRecord.removeFromListById( newAchRecs, achId );
			}
		}

		boolean[] unlocks = p.getShipUnlocks();
		for (int i=0; i < shipBoxes.size(); i++) {
			unlocks[i] = shipBoxes.get(i).isSelected();

			// Remove ship achievements for locked ships
			if ( !unlocks[i] ) {
				for ( Achievement shipAch : DataManager.get().getShipAchievements( DataManager.get().getPlayerShips().get(i) ) ) {
					// Search for records with the doomed id.
					AchievementRecord.removeFromListById( newAchRecs, shipAch.getId() );
				}
			}
		}
		p.setShipUnlocks(unlocks);

		p.setAchievements(newAchRecs);
	}