/**
  * Gets terms in the sermon date order. Result is cached for a max. of a day.
  *
  * @since  0.1.1
  *
  * @param  bool $flush_cache Whether to get fresh results (flush cache)
  *
  * @return mixed Array of terms on success
  */
 protected function get_terms_in_sermon_date_order($flush_cache = false)
 {
     $this->flush_cache = $this->flush_cache || $flush_cache;
     $terms = get_transient($this->id . '_in_sermon_date_order');
     if (!$terms || $this->flush_cache) {
         $sermons = $this->sermons->get_many(array('posts_per_page' => 1000, 'cache_results' => false));
         $taxonomy = $this->taxonomy();
         $terms = array();
         if ($sermons->have_posts()) {
             foreach ($sermons->posts as $post) {
                 $year = get_the_date('Y', $post);
                 if ($post_terms = get_the_terms($post, $taxonomy)) {
                     foreach ($post_terms as $term) {
                         if (!isset($terms[$term->term_id])) {
                             $term->year = $year;
                             $terms[$term->term_id] = $term;
                         }
                     }
                 }
             }
         }
         set_transient($this->id . '_in_sermon_date_order', $terms, DAY_IN_SECONDS);
     }
     return $terms;
 }