func (cmd *MigrateApps) Execute(cliConnection api.Connection) error {
	cmd.MigrateAppsCommand.BeforeAll() //move me to the command

	apiClient, err := api.NewClient(cliConnection)
	if err != nil {
		return err
	}

	appRequestFactory := apiClient.HandleFiltersAndParameters(
		apiClient.Authorize(apiClient.NewGetAppsRequest),
	)

	appPaginatedRequester, err := api.NewPaginatedRequester(cliConnection, appRequestFactory)
	if err != nil {
		return err
	}

	apps, err := cmd.AppsGetterFunc(
		models.ApplicationsParser{},
		appPaginatedRequester,
	)
	if err != nil {
		return err
	}

	spaceRequestFactory := apiClient.HandleFiltersAndParameters(
		apiClient.Authorize(apiClient.NewGetSpacesRequest),
	)

	spacePaginatedRequester, err := api.NewPaginatedRequester(cliConnection, spaceRequestFactory)
	if err != nil {
		return err
	}

	spaces, err := thingdoer.Spaces(
		models.SpacesParser{},
		spacePaginatedRequester,
	)
	if err != nil {
		return err
	}

	spaceMap := make(map[string]models.Space)
	for _, space := range spaces {
		spaceMap[space.Guid] = space
	}

	warnings, errors := cmd.migrateApps(cliConnection, apps, spaceMap, cmd.MaxInFlight)
	cmd.MigrateAppsCommand.AfterAll(len(apps), warnings, errors)

	return nil
}
func ListApps(cliConnection api.Connection, appsGetterFunc thingdoer.AppsGetterFunc, listAppsCommand *ui.ListAppsCommand) error {
	listAppsCommand.BeforeAll()

	appsParser := models.ApplicationsParser{}
	spacesParser := models.SpacesParser{}

	apiClient, err := api.NewClient(cliConnection)
	if err != nil {
		return err
	}

	appRequestFactory := apiClient.HandleFiltersAndParameters(
		apiClient.Authorize(apiClient.NewGetAppsRequest),
	)

	appPaginatedRequester, err := api.NewPaginatedRequester(cliConnection, appRequestFactory)
	if err != nil {
		return err
	}

	apps, err := appsGetterFunc(
		appsParser,
		appPaginatedRequester,
	)
	if err != nil {
		return err
	}

	spaceRequestFactory := apiClient.HandleFiltersAndParameters(
		apiClient.Authorize(apiClient.NewGetSpacesRequest),
	)
	spacesPaginatedRequester, err := api.NewPaginatedRequester(cliConnection, spaceRequestFactory)
	if err != nil {
		return err
	}

	spaces, err := thingdoer.Spaces(
		spacesParser,
		spacesPaginatedRequester,
	)
	if err != nil {
		return err
	}

	spaceMap := make(map[string]models.Space)
	for _, space := range spaces {
		spaceMap[space.Guid] = space
	}

	var appPrinters []ui.ApplicationPrinter
	for _, a := range apps {
		appPrinters = append(appPrinters, &displayhelpers.AppPrinter{
			App:    a,
			Spaces: spaceMap,
		})
	}

	listAppsCommand.AfterAll(appPrinters)

	return nil
}