def sample_entry(attributes)
      entry = Entry.where(attributes.slice(:account, :title)).first

      if entry.nil?
        entry = Entry.create!(attributes) do |created_entry|
          created_entry.theming = attributes.fetch(:account).default_theming

          say_creating_entry(created_entry)
          yield(created_entry) if block_given?
        end

        storyline = entry.draft.storylines.first

        chapter = storyline.chapters.create!(title: 'Chapter 1', position: 0)
        chapter.pages.create!(template: 'background_image')
        chapter.pages.create!(template: 'background_image')

        chapter = storyline.chapters.create!(title: 'Chapter 2', position: 1)
        chapter.pages.create!(template: 'video')
      end

      entry
    end
def sample_entry(attributes)
      entry = Entry.where(attributes.slice(:account, :title)).first

      if entry.nil?
        entry = Entry.create!(attributes) do |created_entry|
          created_entry.theming = attributes.fetch(:account).default_theming

          say_creating_entry(created_entry)
          yield(created_entry) if block_given?
        end

        storyline = entry.draft.storylines.first

        chapter = storyline.chapters.create!(title: 'Chapter 1', position: 0)
        chapter.pages.create!(template: 'background_image')
        chapter.pages.create!(template: 'background_image')

        chapter = storyline.chapters.create!(title: 'Chapter 2', position: 1)
        chapter.pages.create!(template: 'video')
      end

      entry
    end
Create a sample {Entry} with some chapter and pages if no
 entry with that title exists in the given account.

 @param [Hash] attributes  attributes to override defaults
 @option attributes [Account] :account  required
 @option attributes [title] :title  required
 @yield [entry] a block to be called before the entry is saved
 @return [Entry] newly created entry