def update_image_popularity_score(image_to_update = :all)

      def get_score_write_to_db(image)
        popularity_score = calculate_popularity(image)
        image.update_attribute(:popular_score, popularity_score)
      end

      if image_to_update == :all
        images = Lentil::Image.find(image_to_update)
        images.each  do |image|
          get_score_write_to_db(image)
        end
      elsif image_to_update.kind_of?(Integer)
          image = Lentil::Image.find(image_to_update)
          get_score_write_to_db(image)
      end
    end
def update_image_popularity_score(image_to_update = :all)

      def get_score_write_to_db(image)
        popularity_score = calculate_popularity(image)
        image.update_attribute(:popular_score, popularity_score)
      end

      if image_to_update == :all
        images = Lentil::Image.find(image_to_update)
        images.each  do |image|
          get_score_write_to_db(image)
        end
      elsif image_to_update.kind_of?(Integer)
          image = Lentil::Image.find(image_to_update)
          get_score_write_to_db(image)
      end
    end
Takes an image id and updates its popularity score

 @param [integer] id of image to update defaults to :all

 @return [boolean] success/failure of update