It's still brittle. What if a data item has a post_id and an id? I think you should detect at the outset what type `data` is and then do an if statement.