/**
  * Fetches a random element, from a specific category if supplied.
  *
  * @param null $ofCategory
  * @return mixed
  */
 public static function getRandomElement($ofCategory = null)
 {
     $elements = null;
     if (!is_null($ofCategory)) {
         $types = ElementType::whereCategory($ofCategory)->get(['type'])->lists('type');
         $elements = Element::whereIn('type', $types)->get();
     } else {
         $elements = Element::all();
     }
     if ($elements->count() > 0) {
         return $elements->random();
     }
 }