Refactoring few core classes to return generic collections + iterate through these collections using enhanced for-loop

I believe this makes the code much clearer, noticably shorter and easier to refactor in the future. Also I found one oversight bug (check panel instance in the WorkspaceImpl commit) when inner for loop was caling next() on the outer for loop's iterator.