public static string StatusCode(this Device Device) { if (Device.DecommissionedDate.HasValue) return "Decommissioned"; if (!Device.EnrolledDate.HasValue) return "NotEnrolled"; return "Active"; }