public virtual Tuple <bool, byte> DeleteWorker(int id) { Worker worker = Workers.SingleOrDefault(w => w.ID == id); bool success = false; if (worker != null) { if (worker.Attractions.Count > 0) { return(new Tuple <bool, byte>(false, (byte)ModelType.Attraction)); } Overtimes.RemoveRange(worker.Overtimes); Workers.Remove(worker); try { SaveChanges(); success = true; } catch (Exception e) { Logger.LogError($"Exception removing worker! Exception: {e.ToString()}", GetType(), $"DeleteWorker(id: {id})"); } } return(new Tuple <bool, byte>(success, (byte)ModelType.Model)); }