public void Remove(TElement element, bool force) { if (force || element.File.CanClose()) { Func <bool> prompt = element is IDomainFile ? (Func <bool>)GraphFile.PromptFileRemoved : (Func <bool>)PromptUsedAudioRemoved; if (force || element.CanRemove(prompt)) { m_data.Remove(element.Id); Removed.Execute(element); element.Dispose(); } } }