'Save a dashboard\'s metadata'

@api
@has_access_api
@expose(u'/save_dash/<dashboard_id>/', methods=[u'GET', u'POST'])
def save_dash(self, dashboard_id):

    session = db.session()
    dash = session.query(models.Dashboard).filter_by(id=dashboard_id).first()
    check_ownership(dash, raise_if_false=True)
    data = json.loads(request.form.get(u'data'))
    self._set_dash_metadata(dash, data)
    session.merge(dash)
    session.commit()
    session.close()
    return u'SUCCESS'
