def format_company(organization)
      {
        company_id: organization.id,
        name: organization.name,
        created_at: organization.created_at.to_i,
        custom_attributes: {
          industry: organization.industry,
          size: organization.size,
          credit_card_details: organization.has_credit_card_details?,
          credit_card_expiry: organization.credit_card.expiry_date,
          app_count: organization.app_instances.count,
          app_list: organization.app_instances.map(&:name).sort.to_sentence,
          user_count: organization.users.count
        }
      }
    end
def format_company(organization)
      {
        company_id: organization.id,
        name: organization.name,
        created_at: organization.created_at.to_i,
        custom_attributes: {
          industry: organization.industry,
          size: organization.size,
          credit_card_details: organization.has_credit_card_details?,
          credit_card_expiry: organization.credit_card.expiry_date,
          app_count: organization.app_instances.count,
          app_list: organization.app_instances.map(&:name).sort.to_sentence,
          user_count: organization.users.count
        }
      }
    end
Formatting
 TODO: extract to a CRM service