code/DashboardHasManyRelationEditor.php
public function saveDetail($data, $form) {
		$item = $this->item;
		if(!$item->exists()) {
			$item->DashboardPanelID = $this->panel->ID;
			$sort = DataList::create($item->class)->max("SortOrder");
			$item->SortOrder = $sort+1;
			$item->write();
		}
		$form->saveInto($item);
		$item->write();
		return new SS_HTTPResponse("OK");
	}
public function saveDetail($data, $form) {
		$item = $this->item;
		if(!$item->exists()) {
			$item->DashboardPanelID = $this->panel->ID;
			$sort = DataList::create($item->class)->max("SortOrder");
			$item->SortOrder = $sort+1;
			$item->write();
		}
		$form->saveInto($item);
		$item->write();
		return new SS_HTTPResponse("OK");
	}
Saves the DetailForm and writes or creates a new object managed by the editor

@param array The raw POST data from the form
@param Form The DetailForm object