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;
}