diff --git a/fullcalendar.module b/fullcalendar.module
index fb8c83e..d6dd396 100644
--- a/fullcalendar.module
+++ b/fullcalendar.module
@@ -184,8 +184,13 @@ function fullcalendar_update($action, $eid) {
   }
 
   // Save the new start/end values.
-  field_attach_presave($entity_type, $entity);
-  field_attach_update($entity_type, $entity);
+  if (module_exists('entity')) {
+    entity_save($entity_type, $entity);
+  }
+  else {
+    field_attach_presave($entity_type, $entity);
+    field_attach_update($entity_type, $entity);
+  }
 
   drupal_json_output(array('msg' => t('The new event time has been saved.') . ' [' . l(t('Close'), NULL, array('attributes' => array('class' => array('fullcalendar-status-close')))) . ']', 'dom_id' => $_POST['dom_id']));
 }
