def set_fragment_visibility(page_part_key, visible_on_page)
      # TODO: enable this 
      # for page_parts without content like search cmpt.

      page_content_join_model = self.page_contents.find_or_create_by(page_part_key: page_part_key)
      # page_fragment_content.page_contents.find_by_page_id id

      page_content_join_model.visible_on_page = visible_on_page
      page_content_join_model.save!
    end
def set_fragment_visibility(page_part_key, visible_on_page)
      # TODO: enable this 
      # for page_parts without content like search cmpt.

      page_content_join_model = self.page_contents.find_or_create_by(page_part_key: page_part_key)
      # page_fragment_content.page_contents.find_by_page_id id

      page_content_join_model.visible_on_page = visible_on_page
      page_content_join_model.save!
    end
def set_fragment_sort_order(page_part_key, sort_order)
   page_fragment_content = contents.find_by_page_part_key page_part_key
   # using join model for sorting and visibility as it
   # will allow use of same content by different pages
   # with different settings for sorting and visibility
   unless page_fragment_content.present?
     return
   end
   page_content_join_model = page_fragment_content.page_contents.find_by_page_id id
   page_content_join_model.sort_order = sort_order
   page_content_join_model.save!
 end