private bool IsContainerType(Type type)
{
bool isContainerType = type == typeof(IList) || type == typeof(ISet);
if (!isContainerType && type.IsGenericType)
{
Type[] genericArgs = type.GetGenericArguments();
Type genType = typeof(ICollection<>).MakeGenericType(genericArgs);
isContainerType = genType.IsAssignableFrom(type);
}
return isContainerType;
}