Moved data to model to handle duplicate keys