extracted methods to insert_edit.lib.php