At first the questions may seem alike, because the code posted looks alike. When someone actually reads the questions there is a notable difference. In the first setup the data is stored in a database, in the second the data is only in-memory.
Now I cannot discuss if the question was closed justly and I'm stuck with a closed question, and thus I have to come here for an explanation.
In short, is the second question closed justly? If so why? If not, what can I do about this?