Function to insert a tag into a database
Use a transaction, so you won't need all the manual delete queries
Use shorter PDO syntax.
Log errors
Use prepared statements


In the end it should be like

public function insertTag(Tag\Tag $tag)
{   
    try{
        //Names
        $name = new Common\Name();

        $pdo-&gt;beginTransaction();

        //Insert into main table
        $this-&gt;connection-&gt;query("INSERT INTO tag VALUES(null)");

        //Get main table id
        $tagId = $this-&gt;connection-&gt;lastInsertId();

        //Insert into audit tag table
        $sql = "INSERT INTO tag_audit(behaviour,action_peformed,state,tag_id) VALUES(?,'insert','P',?)";
        $this-&gt;connection-&gt;prepare($sql)-&gt;execute([$tag-&gt;getBehaviour(), $tagId]);

        //Insert into names
        // you should be using prepared statements here
        $sql = "INSERT INTO tag_name_audit(name,language,action_peformed,state,tag) VALUES (?,?,?,?,?)";
        $statement = $this-&gt;connection-&gt;prepare($sql);
        foreach (whatever function supplies the name as $name) {
            $statement-&gt;execute([$name]);
        }
        $response = ['status'=&gt;200,'Message'=&gt;'Successfully inserted.'];

        $pdo-&gt;commit();
    }catch(\Exception $e){

         $pdo-&gt;rollback();
         error_log($e);
         $response = ['status'=&gt;409,'Message'=&gt;'Error '.$e-&gt;getCode()];
    }
    $tag-&gt;setResponse($response);
}