public static void removeEntries(string id) { ControlPanel.Repository.SystemProcessThreadRepository sptr = new ControlPanel.Repository.SystemProcessThreadRepository(); var thread = sptr.GetSystemProcessThread(Convert.ToInt16(id)); bool result = sptr.DeleteSystemProcessThread(Convert.ToInt16(id)); if (result) { var threadsofprocess = sptr.GetSystemProcessThreadBySystemProcessId(thread.SystemProcessId); if (threadsofprocess == null) { ControlPanel.Repository.SystemProcessRepository spr = new Repository.SystemProcessRepository(); spr.DeleteSystemProcess(thread.SystemProcessId); } } }