private static string GetValueLessThanMaxValue(this IReflect type, string previousValue) { var maxValue = type.GetMaxValue(); var validValue = Convert.ToDouble(previousValue); while (validValue > maxValue) { validValue = validValue - maxValue; } return(validValue.ToString(CultureInfo.InvariantCulture)); }