private function beforeInsert() { $this->log_content = Callback::searchMovie($this->query); foreach ($this->getContent() as $movie_info) { if (!Movie::model()->with('attributes')->find('tmdb_id=:id', array(':id' => $movie_info['imdb_id']))) { $movie = new Movie(); $movie->setUrlKey($movie_info); $movie->tmdb_id = $movie_info['id']; $movie->imdb_id = $movie_info['imdb_id']; $movie->save(); } } }