public function find_or_create_by_post_id($post_id) { $episode = Episode::find_one_by_property('post_id', $post_id); if ($episode) { return $episode; } $episode = new Episode(); $episode->post_id = $post_id; $episode->save(); return $episode; }