private static AjaxResponse GetAjaxResponse(ControllerContext context, string dataCaptureViewName, object dataCaptureViewModel,
            string contentViewName, object contentViewModel, string viewName, object viewModel, string redirectUrl)
        {
            var response = new AjaxResponse();

            if (!string.IsNullOrEmpty(dataCaptureViewName))
                response.DataCaptureView =  context.RenderPartialViewToString(dataCaptureViewName, dataCaptureViewModel);

            if (!string.IsNullOrEmpty(contentViewName))
                response.ContentView = context.RenderPartialViewToString(contentViewName, contentViewModel);

            if (!string.IsNullOrEmpty(viewName))
                response.Result = context.RenderPartialViewToString(viewName, viewModel);

            if (!string.IsNullOrEmpty(redirectUrl))
                response.RedirectUrl = redirectUrl;
            
            return response;
        }
        private static AjaxResponse GetAjaxResponse(ControllerContext context, string popupViewName, object popupViewModel, string contentViewName, object contentViewModel, 
            string resultViewName, object resultViewModel, string redirectUrl)
        {
            var response = new AjaxResponse();

            if (!string.IsNullOrEmpty(popupViewName))
                response.PopupView = context.RenderPartialViewToString(popupViewName, popupViewModel);

            if (!string.IsNullOrEmpty(contentViewName))
                response.ContentView = context.RenderPartialViewToString(contentViewName, contentViewModel);

            if (!string.IsNullOrEmpty(resultViewName))
                response.Result = context.RenderPartialViewToString(resultViewName, resultViewModel);
            else if(resultViewModel != null)
            {
                response.Result = JsonConvert.SerializeObject(resultViewModel); ;
            }

            if (!string.IsNullOrEmpty(redirectUrl))
                response.RedirectUrl = redirectUrl;

            return response;
        }
        private static AjaxResponse GetAjaxResponse(ControllerContext context, string popupViewName, object popupViewModel, string contentViewName, object contentViewModel, 
            string resultViewName, object resultViewModel, string redirectUrl, bool hasError, string message)
        {
            var response = new AjaxResponse();

            response.HasError = hasError;
            response.Message = message;

            if (!string.IsNullOrEmpty(popupViewName))
                response.PopupView = context.RenderPartialViewToString(popupViewName, popupViewModel);

            if (!string.IsNullOrEmpty(contentViewName))
                response.ContentView = context.RenderPartialViewToString(contentViewName, contentViewModel);

            if (!string.IsNullOrEmpty(resultViewName))
                response.Result = context.RenderPartialViewToString(resultViewName, resultViewModel);
            else if(resultViewModel != null)
                response.Result = resultViewModel;

            if (!string.IsNullOrEmpty(redirectUrl))
                response.RedirectUrl = redirectUrl;

            return response;
        }