def seed_fragment_photo(block_label, photo_file)
      # content_key = self.slug + "_" + page_part_key
      # get in content model associated with page and fragment
      # join_model = page_contents.find_or_create_by(page_part_key: page_part_key)
      # page_fragment_content = join_model.create_content(page_part_key: page_part_key)
      # join_model.save!
      # page_fragment_content = contents.find_or_create_by(page_part_key: page_part_key)

      page_fragment_content = find_or_create_content

      photo = page_fragment_content.content_photos.find_by_block_key(block_label)

      if photo.present?
        return photo
      else
        photo = page_fragment_content.content_photos.create(block_key: block_label)
      end

      if ENV["RAILS_ENV"] == "test"
        # don't create photos for tests
        return nil
      end
      begin
        # if photo_file.is_a?(String)
        # photo.image = photo_file
        photo.image = Pwb::Engine.root.join(photo_file).open
        photo.save!
        print "#{slug}--#{page_part_key} image created: #{photo.optimized_image_url}\n"
        # reload the record to ensure that url is available
        photo.reload
        print "#{slug}--#{page_part_key} image created: #{photo.optimized_image_url}(after reload..)"
      rescue Exception => e
        # log exception to console
        print e
      end
      photo
    end
def seed_fragment_photo(block_label, photo_file)
      # content_key = self.slug + "_" + page_part_key
      # get in content model associated with page and fragment
      # join_model = page_contents.find_or_create_by(page_part_key: page_part_key)
      # page_fragment_content = join_model.create_content(page_part_key: page_part_key)
      # join_model.save!
      # page_fragment_content = contents.find_or_create_by(page_part_key: page_part_key)

      page_fragment_content = find_or_create_content

      photo = page_fragment_content.content_photos.find_by_block_key(block_label)

      if photo.present?
        return photo
      else
        photo = page_fragment_content.content_photos.create(block_key: block_label)
      end

      if ENV["RAILS_ENV"] == "test"
        # don't create photos for tests
        return nil
      end
      begin
        # if photo_file.is_a?(String)
        # photo.image = photo_file
        photo.image = Pwb::Engine.root.join(photo_file).open
        photo.save!
        print "#{slug}--#{page_part_key} image created: #{photo.optimized_image_url}\n"
        # reload the record to ensure that url is available
        photo.reload
        print "#{slug}--#{page_part_key} image created: #{photo.optimized_image_url}(after reload..)"
      rescue Exception => e
        # log exception to console
        print e
      end
      photo
    end
when seeding I only need to ensure that a photo exists for the fragment
 so will return existing photo if it can be found