public void BookingLockoutsForDate(RichTextBox rtb, DateTime date) { rtb.Text = ""; var unitOfWork = new UnitOfWork(); var today = date.Date; var notes = unitOfWork.LockedOutDateRepository.Get(x => today < x.EndDate && today > x.StartDate,includeProperties:"LockOutTimes"); notes = notes.OrderBy(x => x.DateCreated); if (notes.Count() > 0) { rtb.AppendBoldColoredLine("Locked:", System.Drawing.Color.Red); int i = 1; foreach (var note in notes) { rtb.AppendBoldColoredLine(i + ". " + note.Name, System.Drawing.Color.Red); string reason = note.Reason; rtb.AppendLine(reason); if (note.LockOutTimes.Count>0) { foreach(var v in note.LockOutTimes) { rtb.AppendText(v.StartTime.ToShortTimeString() + " - "+ v.EndTime.ToShortTimeString()+", " ); } } } } }