Automatic Set Category For A Custom Post Type

Ok after some research and tests this is the solution I coded

function auto_set_event_categories ( int $post_ID ){
//Post Type of Tribe Events
$post_type = "tribe_events";

//If it is not an Event, exit
if( get_post_type($post_ID) != $post_type){
    return;
}

//Get the values of the custom fields
$customfields = tribe_get_custom_fields ( $post_ID );

//Extract the relevant custom fields
$dance_style = explode( ",", $customfields["Dance Style"] );
$event_type = explode( ",", $customfields["Event Type"] );

//Merge the arrays to have a unique, create the array for the ids
$post_categories = array_merge($dance_style, $event_type);
$post_categories_id = array();

//Scan the taxonomies and find the IDs for the custom categories
foreach( $post_categories as $catdesc){
    $term = get_term_by( "name", $catdesc, "tribe_events_cat" );
    $id = (int)$term->term_id;
    if( $id != 0 ){
        array_push( $post_categories_id, $id );
    }
}

//If no categories selected, exit
if( empty($post_categories_id) ){
    return;
}

//Set the Category

wp_set_post_terms( $post_ID, $post_categories_id, "tribe_events_cat" );

return $post_ID;

}

//Add hook to execute auto_set_event_categories when a post is created/saved
add_action( "save_post", "auto_set_event_categories", 100);

Any suggestion to improve the code will be appreciated
Thank you

tech