/// <summary> /// Delete Section And ALL Its Children /// </summary> /// <param name="id"></param> /// <returns>1)section, when deletes all succesfully 2) null, when failed to delete section or one of its children</returns> public Section DeleteSectionAndChildren(string id) { var section = Sections.Include(c => c.Lessons).FirstOrDefault(c => c.Id == id); if (section != null) { Lessons.RemoveRange(section.Lessons); Sections.Remove(section); return(section); } return(null); }