void AddFieldInstance(FieldInstance instance) { instance.SetField(this); if (fieldList.First == null || instance.Position < fieldList.First.Value.Position) { fieldList.AddFirst(instance); } else if (fieldList.Last.Value.Position <= instance.Position) { fieldList.AddLast(instance); } else { foreach (var entity in fieldList) { LinkedListNode<FieldInstance> current = fieldList.Find(entity); if (current.Value.Position <= instance.Position && instance.Position < current.Next.Value.Position) { fieldList.AddAfter(current, instance); break; } } } }