public function new_posttype($data){
    global $wpdb;

    // escape all the strings
    array_walk_recursive($data, array($this, 'escape_data'));

    $sql = $wpdb->prepare(
      "INSERT INTO " . MF_TABLE_POSTTYPES .
      " (type, name, description, arguments, active)" .
      " values" .
      " (%s, %s, %s, %s, %d)",
      $data['core']['type'],
      $data['core']['label'],
      $data['core']['description'],
      serialize($data),
      1
    );

    $wpdb->query($sql);
    $postTypeId = $wpdb->insert_id;
    return $postTypeId;
  }