protected override IList <JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization) { IList <JsonProperty> orignalProperties = base.CreateProperties(type, memberSerialization); var jsonProperties = new List <JsonProperty>(orignalProperties.Count); jsonProperties.AddRange(orignalProperties); var idProperty = jsonProperties.SingleOrDefault( x => x.PropertyType == typeof(ObjectId) && (x.PropertyName.Equals("Id", StringComparison.OrdinalIgnoreCase) || (x.PropertyName.Equals("_Id", StringComparison.OrdinalIgnoreCase)))); if (idProperty != null) { var originalName = idProperty.PropertyName; idProperty.PropertyName = IdPropertyName; idProperty.ShouldSerialize = value => !TypeExtension.IdIsEmpty(value, originalName); jsonProperties.Sort(IdMustBeFirst); } return(jsonProperties); }