private void ReflectionToSetUpdatedValues(Employee original, Employee updatedUser) { foreach (PropertyInfo propertyInfo in original.GetType().GetProperties()) { if (propertyInfo.GetValue(updatedUser, null) == null) { propertyInfo.SetValue(updatedUser, propertyInfo.GetValue(original, null), null); } } BusinessContext.Attach(updatedUser); BusinessContext.Entry(updatedUser).State = EntityState.Modified; BusinessContext.SaveChanges(); }