private static void DisposeFacelessFrames(IList<Frame> motionFrames, ImageProcess.Target[] portraits) { var noPortraitFrameQuery = from m in motionFrames where !portraits.Any(t => t.BaseFrame.guid.Equals(m.Guid)) select m; Array.ForEach(noPortraitFrameQuery.ToArray(), mf => { motionFrames.Remove(mf); mf.Dispose(); }); }