@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Log.d(TAG, "onCreate");
    ButterKnife.bind(this);
    app.component.inject(this);

    setSupportActionBar(toolbar);

    realm = Realm.getInstance(this);

    getListFromRealm();

    recentSearchesRecycler.setAdapter(new PreviousSearchesAdapter(this, previousSearchList));
    recentSearchesRecycler.setLayoutManager(new LinearLayoutManager(this));

    movieSearch.setAdapter(new MovieSearchAdapter(this, android.R.layout.simple_list_item_1));
    movieSearch.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            MovieBase selected = (MovieBase) parent.getItemAtPosition(position);
            bus.post(new TitleSearchEvent(selected.getTitle()));
          }
        });

    movieSearch.setOnEditorActionListener(
        new TextView.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
              movieSearchInputLayout.setError(null);
              // check length of text
              if (movieSearch.getText().toString().trim().isEmpty()) {
                movieSearchInputLayout.setError(getString(R.string.search_box_empty));
                return false;
              }
              bus.post(new TitleSearchEvent(movieSearch.getText().toString().trim()));

              return true;
            }
            return false;
          }
        });
  }
 @Override
 protected void onStart() {
   super.onStart();
   bus.register(this);
 }
 @Override
 protected void onStop() {
   super.onStop();
   bus.unregister(this);
 }