public ActionResult AddFlow()
        {
            string _title     = Request["title"] != null ? Request["title"].ToString() : string.Empty;
            string _serviceID = Request["serviceID"] != null ? Request["serviceID"].ToString() : string.Empty;
            string _flowID    = Request["flowID"] != null ? Request["flowID"].ToString() : string.Empty;

            ServiceTemplateModel serviceModel = FlowInspectorApplication.GetServiceModelByString(_serviceID);

            if (serviceModel == null)
            {
                return(this.Json(new { status = false, message = "Internal error. COuld not load serviceModel by id:" + _serviceID }));
            }

            if (string.IsNullOrEmpty(_title))
            {
                return(this.Json(new { strus = false, message = "Title is not set!" }));
            }

            if (string.IsNullOrEmpty(_serviceID))
            {
                return(this.Json(new { status = false, message = "ServiceID is not set" }));
            }

            int flowID;

            if (!Int32.TryParse(_flowID, out flowID))
            {
                return(this.Json(new { status = false, message = "FlowID is not set" }));
            }

            if (flowID == -1)
            {
                TemplateServiceFlow ts = new TemplateServiceFlow(flowID, serviceModel.ServiceData, _title, DateTime.Now, DateTime.Now);
                ts.Insert();

                serviceModel.Flows.Add(ts);
                return(this.Json(new { status = true, message = "Inserted", id = ts.ID }));
            }
            else
            {
                TemplateServiceFlow ts = TemplateServiceFlow.CreateManager().Load(flowID);
                ts.Title = _title;
                ts.Update();
                return(this.Json(new { status = true, message = "Updated!", id = ts.ID }));
            }
        }