public int Add(InsurancePlanAddRequest model, int userId)
        {
            int    id       = 0;
            string procName = "dbo.InsurancePlans_Insert_V2";

            _data.ExecuteNonQuery(procName,
                                  delegate(SqlParameterCollection col)
            {
                col.AddWithValue("@InsuranceProviderId", model.InsuranceProviderId);
                col.AddWithValue("@Name", model.Name);
                col.AddWithValue("@PlanTypeId", model.PlanTypeId);
                col.AddWithValue("@PlanLevelId", model.PlanLevelId);
                col.AddWithValue("@Code", model.Code);
                col.AddWithValue("@PlanStatusId", model.PlanStatusId);
                col.AddWithValue("@MinAge", model.MinAge);
                col.AddWithValue("@MaxAge", model.MaxAge);
                col.AddWithValue("@CreatedBy", userId);

                SqlParameter idOut = new SqlParameter("@Id", SqlDbType.Int);
                idOut.Direction    = ParameterDirection.Output;

                col.Add(idOut);
            }, delegate(SqlParameterCollection returnCollection)
            {
                object returnId = returnCollection["@Id"].Value;
                Int32.TryParse(returnId.ToString(), out id);
            });
            return(id);
        }
        public ActionResult <ItemResponse <int> > Create(InsurancePlanAddRequest model)
        {
            ObjectResult result = null;

            try
            {
                int userId = _authService.GetCurrentUserId();
                int id     = _service.Add(model, userId);
                ItemResponse <int> response = new ItemResponse <int>();
                response.Item = id;
                result        = Created201(response);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                ErrorResponse response = new ErrorResponse(ex.Message);
                result = StatusCode(500, response);
            }
            return(result);
        }