refactor Each<T>, QueryEach<T> and EachWhere<T> methods + fix bug in QueryEach<T>

refactor Each<T>, QueryEach<T> and EachWhere<T> methods + fix bug in QueryEach<T>