func CreatePayloadFromItems(items []types.MessageItem, title string, colors [types.MessageLevelCount]uint, omitted int) (WebhookPayload, error) {

	metaCount := 1
	if omitted < 1 && len(title) < 1 {
		metaCount = 0
	}
	itemCount := util.Min(9, len(items))

	embeds := make([]embedItem, metaCount, itemCount+metaCount)

	for _, item := range items {

		color := uint(0)
		if item.Level >= types.Unknown && int(item.Level) < len(colors) {
			color = colors[item.Level]
		}

		ei := embedItem{
			Content: item.Text,
			Color:   color,
		}

		if item.Level != types.Unknown {
			ei.Footer = &embedFooter{
				Text: item.Level.String(),
			}
		}

		if !item.Timestamp.IsZero() {
			ei.Timestamp = item.Timestamp.UTC().Format(time.RFC3339)
		}

		embeds = append(embeds, ei)
	}

	embeds[0].Title = title
	if omitted > 0 {
		embeds[0].Footer = &embedFooter{
			Text: fmt.Sprintf("... (%v character(s) where omitted)", omitted),
		}
	}

	return WebhookPayload{
		Embeds: embeds,
	}, nil
}