Updated solution to use entity framework.