/// <summary>
        /// The delete.
        /// </summary>
        /// <param name="patientId"> Patient ID </param>
        /// <param name="id">
        /// The id.
        /// </param>
        /// <returns>
        /// The <see cref="HttpResponseMessage"/>.
        /// </returns>
        public HttpResponseMessage Delete(int patientId, int id)
        {
            try
            {
                AccessControl.VerifyUserAccessToPatient(patientId);
                if (id != 0)
                {
                    // Delete Insurance
                    // Insurance can not be deleted if it has been used in a previous transaction or claim
                    if (this.patientInsuranceManager.CanDeletePatientInsurance(id))
                    {
                        var relationshipsIt2Manager     = new PatientRelationshipsIt2Manager();
                        var matchingDependentInsurances = relationshipsIt2Manager.GetMatchingDependentInsurances(patientId, id);
                        //// Delete Dependents Insurance
                        if (matchingDependentInsurances != null && matchingDependentInsurances.Any())
                        {
                            foreach (var dependentInsurance in matchingDependentInsurances)
                            {
                                if (this.patientInsuranceManager.CanDeletePatientInsurance(dependentInsurance.ID))
                                {
                                    PatientManager.DeletePatientInsuranceAlsl(dependentInsurance.ID);
                                    this.patientInsuranceManager.DeletePatientInsuranceByPatientInsuranceId(dependentInsurance.PatientID.GetValueOrDefault(), dependentInsurance.ID);
                                }
                                else
                                {
                                    //// Inactivate dependent insurance as it can't be deleted
                                    var dependentPatientInsuranceExtension = PatientManager.GetPatientInsuranceExtension(dependentInsurance.PatientID.GetValueOrDefault(), dependentInsurance.ID);
                                    dependentPatientInsuranceExtension.IsActive = false;
                                    var alslInsurances = new List <PatientInsuranceAlsl> {
                                        dependentPatientInsuranceExtension
                                    };
                                    PatientManager.SavePatientInsuranceAlsl(alslInsurances);
                                }
                            }
                        }

                        //// Delete Parent Insurance
                        PatientManager.DeletePatientInsuranceAlsl(id);
                        this.patientInsuranceManager.DeletePatientInsuranceByPatientInsuranceId(patientId, id);
                        return(new HttpResponseMessage(HttpStatusCode.NoContent));
                    }

                    const string Message = "The insurance carrier/plan has associated eligibilities and cannot be deleted. Instead of deleting the insurance carrier/plan, you can inactivate it.";
                    return(Request.CreateResponse(HttpStatusCode.Conflict, Message));
                }

                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            catch (Exception ex)
            {
                var error = string.Format("Delete({0}, {1}{2} {3}", patientId, id, ")\n", ex);
                return(HandleExceptions.LogExceptions(error, Logger, ex));
            }
        }