foreach ($data["attributes"] as $attribute) {
     $obj_attribute = new attributes();
     $obj_attribute->load_data();
     $obj_attribute->id = $attribute["id"];
     //if attribute is to be deleted, call delete action
     if (isset($attribute["mode"]) && $attribute["mode"] == "delete") {
         $obj_attribute->action_delete();
     } elseif (empty($attribute["mode"])) {
         $obj_attribute->id_owner = $obj_customer->id;
         $obj_attribute->type = "customer";
         $obj_attribute->id_group = $attribute["id_group"];
         $obj_attribute->data["key"] = $attribute["key"];
         $obj_attribute->data["value"] = $attribute["value"];
         //if id doesn't exist, create new
         if (!$obj_attribute->verify_id()) {
             $obj_attribute->action_create();
         } elseif ($obj_attribute->data["value"] != $attribute["value"] || $obj_attribute->data["key"] != $attribute["key"] || isset($attribute["id_group"]) && $obj_attribute->data["id_group"] != $attribute["id_group"]) {
             log_write("debug", "process", "Updating attribute " . $attribute["id"] . " due to changed details");
             $obj_attribute->action_update();
         }
     }
 }
 //check for errors
 if (!error_check()) {
     $sql_obj->trans_commit();
 } else {
     // error encountered
     log_write("error", "process", "An unexpected error occured, the attributes remain unchanged");
     $sql_obj->trans_rollback();
 }
 /*