1) I suggest you mark your discussion as a question if you are asking something. Because otherwise it looks like you want just to discuss this topic.
2) Look at this thread I mentioned above. I think that they both are very close to each other.
3) You can also use this approach which is based on using of HashMap class
I adapted the second solution to my project and it works thanks a lot