/// <summary>
        /// Delete device from database
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        public ActionResult DeleteDevice(int deviceId)
        {
            StringBuilder objStringBuilderError = new StringBuilder();
            try
            {
                if (Session["UserName"] != null)
                {
                    using (JetstreamClient objMainServiceClient = new JetstreamClient())
                    {
                        var device = objMainServiceClient.GetDeviceById(deviceId);
                        objMainServiceClient.DeleteDevice(deviceId);

                        // construct a Jetstream service client
                        JetstreamServiceClient client = new JetstreamServiceClient(JetstreamConfiguration.Url, JetstreamConfiguration.ApplicationAccessKey);

                        RemoveLogicalDeviceRequest removeRequest = new RemoveLogicalDeviceRequest
                        {
                            LogicalDeviceId = device.LogicalDeviceId
                        };

                        //Remove device from jetstream
                        client.RemoveLogicalDevice(removeRequest);

                    }
                    Success(JetstreamResource.DeviceDeleteMessage, true);
                    return RedirectToAction("DeviceDetail", "Device");
                }
                else
                {
                    return RedirectToAction("UserLogin", "Login");
                }
            }
            catch (FaultException<ServiceData> fex)
            {
                objStringBuilderError.AppendLine("In method : DeleteDevice(int deviceId) :: DeviceController");
                objStringBuilderError.AppendFormat("ErrorMessage::{0} {1}", fex.Detail.ErrorMessage, Environment.NewLine);
                objStringBuilderError.AppendFormat("ErrorDetails::{0} {1}", Environment.NewLine, fex.Detail.ErrorDetails);

                SaveLogger.SaveLoggerError(objStringBuilderError.ToString());
                return View("Error");
            }
            catch (Exception ex)
            {
                objStringBuilderError.AppendLine("In method : DeleteDevice(int deviceId) :: DeviceController");
                objStringBuilderError.AppendFormat("ErrorMessage::{0} {1}", ex.Message, Environment.NewLine);
                objStringBuilderError.AppendFormat("ErrorDetails::{0} {1}", Environment.NewLine, ex.ToString());

                SaveLogger.SaveLoggerError(objStringBuilderError.ToString());
                return View("Error");
            }
        }