/// <summary>
        /// Function delete the Form 941 Return to Efile
        /// </summary>
        /// <param name="submissionId">SubmissionId passed to delete the 941 return</param>
        /// <returns>DeleteReturnResponse</returns>
        public ActionResult Delete(Guid submissionId)
        {
            var deleteReturnRequest      = new DeleteReturnRequest();
            var deleteReturnResponse     = new DeleteReturnResponse();
            var deleteReturnResponseJSON = string.Empty;

            if (submissionId != null && submissionId != Guid.Empty)
            {
                deleteReturnRequest.SubmissionId = submissionId;
                // Getting the RecordIds for SubmissionId
                var recordIdsFromSession = APISession.GetForm941RecordIdsBySubmissionId(submissionId);
                deleteReturnRequest.RecordIds = recordIdsFromSession != null ? recordIdsFromSession.RecordIds : null;
                if (deleteReturnRequest.RecordIds != null && deleteReturnRequest.RecordIds.Count > 0)
                {
                    using (var client = new PublicAPIClient())
                    {
                        //API URL to Transmit Form 941 Return
                        string requestUri = "Form941/Delete";

                        //POST
                        APIGenerateAuthHeader.GenerateAuthHeader(client, requestUri, "POST");

                        //Get Response
                        var _response = client.PostAsJsonAsync(requestUri, deleteReturnRequest).Result;
                        if (_response != null && _response.IsSuccessStatusCode)
                        {
                            //Read Response
                            var createResponse = _response.Content.ReadAsAsync <DeleteReturnResponse>().Result;
                            if (createResponse != null)
                            {
                                deleteReturnResponseJSON = JsonConvert.SerializeObject(createResponse, Formatting.Indented);
                                deleteReturnResponse     = new JavaScriptSerializer().Deserialize <DeleteReturnResponse>(deleteReturnResponseJSON);
                                if (deleteReturnResponse != null && deleteReturnResponse.StatusCode == (int)StatusCode.Success)
                                {
                                    //Remove Submission and RecordId from session
                                    APISession.DeleteForm941APIResponse(submissionId);
                                }
                            }
                        }
                        else
                        {
                            var createResponse = _response.Content.ReadAsAsync <Object>().Result;
                            deleteReturnResponseJSON = JsonConvert.SerializeObject(createResponse, Formatting.Indented);
                            deleteReturnResponse     = new JavaScriptSerializer().Deserialize <DeleteReturnResponse>(deleteReturnResponseJSON);
                        }
                    }
                }
            }
            return(PartialView(deleteReturnResponse));
        }
        /// <summary>
        /// Function delete the Form 941 Return to Efile
        /// </summary>
        /// <param name="submissionId">SubmissionId passed to delete the 941 return</param>
        /// <returns>DeleteReturnResponse</returns>
        public ActionResult Delete(Guid submissionId)
        {
            var deleteReturnRequest      = new DeleteReturnRequest();
            var deleteReturnResponse     = new DeleteReturnResponse();
            var deleteReturnResponseJSON = string.Empty;

            if (submissionId != null && submissionId != Guid.Empty)
            {
                deleteReturnRequest.SubmissionId = submissionId;
                // Getting the RecordIds for SubmissionId
                var recordIdsFromSession = APISession.GetForm941RecordIdsBySubmissionId(submissionId);
                deleteReturnRequest.RecordIds = recordIdsFromSession != null ? recordIdsFromSession.RecordIds : null;
                if (deleteReturnRequest.RecordIds != null && deleteReturnRequest.RecordIds.Count > 0)
                {
                    string authType = Utility.GetAppSettings("AuthenticationType");
                    if (!string.IsNullOrWhiteSpace(authType) && authType.ToUpper() == "JWT")
                    {
                        //Get URLs from App.Config
                        string oAuthApiUrl = Utility.GetAppSettings("OAuthApiUrl");
                        string apiUrl      = Utility.GetAppSettings("PublicAPIUrlWithJWT");

                        //Call OAuth API
                        using (var oAuthClient = new HttpClient())
                        {
                            string oAuthRequestUri = Utility.GetAppSettings("OAuthApiMethodRoute");
                            oAuthClient.BaseAddress = new Uri(oAuthApiUrl);

                            //Generate JWS and get access token (JWT)
                            OAuthGenerator.GenerateJWSAndGetAccessToken(oAuthClient);

                            //Read OAuth API response
                            var response = oAuthClient.GetAsync(oAuthRequestUri).Result;
                            if (response != null && response.IsSuccessStatusCode)
                            {
                                var oauthApiResponse = response.Content.ReadAsAsync <AccessTokenResponse>().Result;
                                if (oauthApiResponse != null && oauthApiResponse.StatusCode == 200)
                                {
                                    //Get Access token from OAuth API response
                                    string accessToken = oauthApiResponse.AccessToken;
                                    //Access token is valid for one hour. After that call OAuth API again & get new Access token.

                                    if (!string.IsNullOrWhiteSpace(accessToken))
                                    {
                                        //Call TaxBandits API using the Access token
                                        //Access token is valid for one hour. After that call OAuth API again & get new Access token.
                                        using (var apiClient = new HttpClient())
                                        {
                                            //API URL to Transmit Form 941 Return
                                            string requestUri = "Form941/Delete";

                                            apiClient.BaseAddress = new Uri(apiUrl);
                                            //Construct HTTP headers
                                            //If Access token got expired, call OAuth API again & get new Access token.
                                            OAuthGenerator.ConstructHeadersWithAccessToken(apiClient, accessToken);

                                            //Get Response
                                            var _response = apiClient.PostAsJsonAsync(requestUri, deleteReturnRequest).Result;
                                            if (_response != null && _response.IsSuccessStatusCode)
                                            {
                                                //Read Response
                                                var createResponse = _response.Content.ReadAsAsync <DeleteReturnResponse>().Result;
                                                if (createResponse != null)
                                                {
                                                    deleteReturnResponseJSON = JsonConvert.SerializeObject(createResponse, Formatting.Indented);
                                                    deleteReturnResponse     = new JavaScriptSerializer().Deserialize <DeleteReturnResponse>(deleteReturnResponseJSON);
                                                    if (deleteReturnResponse != null && deleteReturnResponse.StatusCode == (int)StatusCode.Success)
                                                    {
                                                        //Remove Submission and RecordId from session
                                                        APISession.DeleteForm941APIResponse(submissionId);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                var createResponse = _response.Content.ReadAsAsync <Object>().Result;
                                                deleteReturnResponseJSON = JsonConvert.SerializeObject(createResponse, Formatting.Indented);
                                                deleteReturnResponse     = new JavaScriptSerializer().Deserialize <DeleteReturnResponse>(deleteReturnResponseJSON);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        using (var client = new PublicAPIClient())
                        {
                            //API URL to Transmit Form 941 Return
                            string requestUri = "Form941/Delete";

                            //POST
                            APIGenerateAuthHeader.GenerateAuthHeader(client, requestUri, "POST");

                            //Get Response
                            var _response = client.PostAsJsonAsync(requestUri, deleteReturnRequest).Result;
                            if (_response != null && _response.IsSuccessStatusCode)
                            {
                                //Read Response
                                var createResponse = _response.Content.ReadAsAsync <DeleteReturnResponse>().Result;
                                if (createResponse != null)
                                {
                                    deleteReturnResponseJSON = JsonConvert.SerializeObject(createResponse, Formatting.Indented);
                                    deleteReturnResponse     = new JavaScriptSerializer().Deserialize <DeleteReturnResponse>(deleteReturnResponseJSON);
                                    if (deleteReturnResponse != null && deleteReturnResponse.StatusCode == (int)StatusCode.Success)
                                    {
                                        //Remove Submission and RecordId from session
                                        APISession.DeleteForm941APIResponse(submissionId);
                                    }
                                }
                            }
                            else
                            {
                                var createResponse = _response.Content.ReadAsAsync <Object>().Result;
                                deleteReturnResponseJSON = JsonConvert.SerializeObject(createResponse, Formatting.Indented);
                                deleteReturnResponse     = new JavaScriptSerializer().Deserialize <DeleteReturnResponse>(deleteReturnResponseJSON);
                            }
                        }
                    }
                }
            }
            return(PartialView(deleteReturnResponse));
        }