Added flash message in function store for success or failure