Utilies for iterating through arrays using promises