- You almost had it here, your logic is that you want to open the database and check if the movie is in it; 
- If it is not in it then you want to query the API and save the rest into the database; 
- Currently your code 25-27 are not executing the sql code on the database compare them to lines 62-65;
- Because we want to repeat the process of opening the database and and executing sql queries - it is better to pull lines 62-65 into a method that we will then go and call twice; 
- Take a look at the amendments I have made, you are still going to have the refactor slightly the @movie_query instance variable for the values to show up in the view; 

![image](https://f.cloud.github.com/assets/3854347/2428270/ba43abd8-ac3c-11e3-9b89-a6101a770128.png)