public virtual uploadPhotoResponse uploadPhoto(uploadPhotoRequest request)
        {
            try
            {
                string uploadPath = AppDomain.CurrentDomain.BaseDirectory;

                Common.CustomTextTraceSource ts = new Common.CustomTextTraceSource("CommercialVehicleCollisionWSPImpl.CommercialVehicleCollisionWebService.getDocument",
                    "MyTraceSource", SourceLevels.Information);

                ts.TraceInformation("Upload Path: <{0}>", uploadPath != null ? uploadPath : "NULL");

                string uploadFolder = ConfigurationManager.AppSettings["UploadFolder"];
                                
                if (String.IsNullOrEmpty(uploadFolder))
                {
                    throw new InvalidOperationException("Upload folder not present.");
                }

                string upLoadFullPath = Path.Combine(uploadPath, uploadFolder);

                if (!Directory.Exists(upLoadFullPath))
                {
                    //Directory.CreateDirectory(upLoadFullPath);
                    throw new InvalidOperationException("Upload folder not present.");
                }


                string _uploadFilename = ConfigurationManager.AppSettings["UploadFilePrefix"];

                string photoId = System.Guid.NewGuid().ToString();
                _uploadFilename += photoId;
                _uploadFilename += ".jpg";


                string path = Path.Combine(upLoadFullPath, _uploadFilename);

                ts.TraceInformation("Path: <{0}>", path != null ? path : "NULL");
                
                if (File.Exists(path))
                {
                    if ((File.GetAttributes(path) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
                    {
                        File.SetAttributes(path, FileAttributes.Normal);
                    }

                    File.Delete(path);
                }

                _uploadFilename = path;

                SaveImage(_uploadFilename, request.Photo);

                uploadPhotoResponse photoResponse = new uploadPhotoResponse(photoId);

                return photoResponse;
            }
            catch (Exception e)
            {
                Debug.WriteLine("Server exception: " + e.ToString());

                throw;
            }
        }
        public uploadPhotoResponse uploadPhoto(uploadPhotoRequest request)
        {
            Common.CustomTextTraceSource ts = new Common.CustomTextTraceSource("WebServiceConsumer.WebServiceConsumer.uploadPhoto",
                "MyTraceSource", SourceLevels.Information);

            ICommercialVehicleCollisionPortTypeChannel channel = GetClientProxyChannel();

            try
            {
                uploadPhotoResponse resp = channel.uploadPhoto(request);

                channel.Close();

                return resp;
            }
            catch (FaultException)
            {
                channel.Abort();
                throw;
            }
            catch (CommunicationException)
            {
                channel.Abort();
                throw;
            }
            catch (TimeoutException)
            {
                channel.Abort();
                throw;
            }
            catch (Exception e)
            {
                ts.TraceInformation("Exception: " + e.Message);
                if (e.InnerException != null)
                {
                    ts.TraceInformation("InnerException: " + e.InnerException.Message);
                }

                channel.Abort();

                throw;
            }
        }