private void FixupDepartment(Department previousValue)
{
if (previousValue != null && previousValue.Courses.Contains(this))
{
previousValue.Courses.Remove(this);
}
if (Department != null)
{
if (!Department.Courses.Contains(this))
{
Department.Courses.Add(this);
}
if (DepartmentId != Department.DepartmentId)
{
DepartmentId = Department.DepartmentId;
}
}
}