void FStreamingLevelModel::OnDrop(const TSharedPtr<FLevelDragDropOp>& Op)
{
	TArray<ULevelStreaming*> DropStreamingLevels;
	
	for (auto It = Op->StreamingLevelsToDrop.CreateConstIterator(); It; ++It)
	{
		if ((*It).IsValid())
		{
			DropStreamingLevels.AddUnique((*It).Get());
		}
	}	
	
	// Prevent dropping items on itself
	if (DropStreamingLevels.Num() && DropStreamingLevels.Find(LevelStreaming.Get()) == INDEX_NONE)
	{
		UWorld* CurrentWorld = LevelCollectionModel.GetWorld();
		auto& WorldStreamingLevels = CurrentWorld->StreamingLevels;
		// Remove streaming level objects from a world streaming levels list
		for (auto It : DropStreamingLevels)
		{
			WorldStreamingLevels.Remove(It);
		}
		
		// Find a new place where to insert the in a world streaming levels list
		// Right after the current level, or at start of the list in case if this is persistent level
		int32 InsertIndex = WorldStreamingLevels.Find(LevelStreaming.Get());
		if (InsertIndex == INDEX_NONE)
		{
			InsertIndex = 0;
		}
		else
		{
			InsertIndex++;
		}

		WorldStreamingLevels.Insert(DropStreamingLevels, InsertIndex);
		CurrentWorld->MarkPackageDirty();
			
		// Force levels list refresh
		LevelCollectionModel.PopulateLevelsList();
	}
}
bool EditorDestroyLevel( ULevel* InLevel )
{
    check(InLevel);
    check(!InLevel->IsPersistentLevel());

    InLevel->ReleaseRenderingResources();

    GStreamingManager->RemoveLevel( InLevel );
    UWorld* World = InLevel->OwningWorld;
    World->RemoveLevel(InLevel);
    InLevel->ClearLevelComponents();

    int32 NumFailedDestroyedAttempts = 0;
    bool bDestroyedActor = false;

    for(int32 ActorIndex = 0; ActorIndex < InLevel->Actors.Num(); ++ActorIndex)
    {
        AActor* ActorToRemove = InLevel->Actors[ActorIndex];
        if (ActorToRemove)
        {
            bDestroyedActor = World->EditorDestroyActor(ActorToRemove, false);

            // Keep track of how many actors were not destroyed because all actors need to be destroyed
            if(!bDestroyedActor)
            {
                NumFailedDestroyedAttempts++;
            }
        }
    }

    if(NumFailedDestroyedAttempts > 0)
    {
        UE_LOG(LogLevelTools, Log, TEXT("Failed to destroy %d actors after attempting to destroy level!"), NumFailedDestroyedAttempts);
    }

    InLevel->MarkPendingKill();
    InLevel->GetOuter()->ClearFlags(RF_Public|RF_Standalone);
    World->MarkPackageDirty();
    World->BroadcastLevelsChanged();

    return true;
}