internal async Task<ApplicationCollection> RemoveAsync()
{
if (Path == RootPath)
{
throw new InvalidOperationException("Root application cannot be removed. Please remove the site.");
}
var newApps = new ApplicationCollection(Site);
foreach (Application item in Parent)
{
if (item == this)
{
item.Delete();
continue;
}
item.Parent = newApps;
newApps.Add(item);
}
newApps.Parent.Applications = newApps;
return newApps;
}