Seperate generic implementation from Flask integration, Step 1

Splitting up graph_store_do into a function independent from flask and
one that integrates the other with flask.
Seperate generic implementation from Flask integration, Step 2
Moving more stuff into the generic_endpoint
Fixing bugs in generic endpoint
Fixing bugs in flask integration