public static Block ToEntity(this BlockModel instance) { if (instance.IsNull()) { return(null); } return(new Block { Announcements = instance.Announcements.SelectIfNotNull(x => x.ToEntity()).ToListIfNotNull(), Teachers = instance.Teachers.SelectIfNotNull(x => x.ToEntity()).ToListIfNotNull(), EndDate = instance.EndDate, StartDate = instance.StartDate, ClassCapacity = instance.ClassCapacity, Classes = instance.Classes.SelectIfNotNull(x => x.ToEntity()).ToListIfNotNull(), EnroledStudents = instance.EnroledStudents.SelectIfNotNull(x => x.ToEntity()).ToListIfNotNull(), Name = instance.Name, Id = instance.Id, MinutesPerClass = instance.MinutesPerClass, NumberOfClasses = instance.NumberOfClasses, Room = instance.Room.ToEntity(), IsInviteOnly = instance.IsInviteOnly }); }