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

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

    $sql = $wpdb->prepare(
      "INSERT INTO ". MF_TABLE_CUSTOM_GROUPS .
      " (name, label, post_type, duplicated, expanded) ".
      " VALUES (%s, %s, %s, %d, %d)",
      $data['core']['name'],
      $data['core']['label'],
      $data['core']['post_type'],
      $data['core']['duplicate'],
      1
    );
    $wpdb->query($sql);

    $postTypeId = $wpdb->insert_id;
    return $postTypeId;
  }