public EntityStateWrapperContainer Modify(IQueryRepository queryRepository, ContosoUniversity.Domain.Core.Behaviours.Instructors.InstructorModifyAndCourses.CommandModel commandModel)
        {
            var retVal = new EntityStateWrapperContainer();

            // Removals first
            Courses.Clear();
            if (OfficeAssignment != null && commandModel.OfficeLocation == null)
                retVal.DeleteEntity(OfficeAssignment);

            // Update properties
            FirstMidName = commandModel.FirstMidName;
            LastName = commandModel.LastName;
            HireDate = commandModel.HireDate;
            OfficeAssignment = new OfficeAssignment { Location = commandModel.OfficeLocation };

            if (commandModel.SelectedCourses != null)
            {
                Courses = queryRepository.GetEntities<Course>(
                    new FindByIdsSpecificationStrategy<Course>(p => p.CourseID, commandModel.SelectedCourses)).ToList();
            }

            retVal.ModifyEntity(this);
            return retVal;
        }
 public EntityStateWrapperContainer Delete()
 {
     OfficeAssignment = null;
     return new EntityStateWrapperContainer().DeleteEntity(this);
 }