Added a toDictionary method

This is something I have found myself doing a few times in the past, where I have an array of items that have some form of unique key. This method allows you to easily convert the array into a dictionary.