/// <summary>
        /// takes in an image marks that image and saves it the DB
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="fileBytes"></param>
        /// <param name="imageName"></param>
        /// <param name="radio"></param>
        /// <param name="transparentSignatureBackground"></param>
        /// <returns>id of uploaded image</returns>
        public FileUploadResponse FileUpload(int userId, byte[] fileBytes, string imageName, int radio, bool transparentSignatureBackground)
        {
            FileUploadResponse response = new FileUploadResponse();
            var currentUser = _dbContext.Users.Where(x => x.Id == userId).FirstOrDefault();
            currentUser.NumberOfImagesMarked++;


            //create, initialize new markedImage then save to db
            Models.Image markedImage = new Models.Image();
            markedImage.OriginalImageBinary = fileBytes;
            markedImage.Filename = imageName;
            markedImage.UserId = HttpContext.Current.User.Identity.GetUserId<int>();
            markedImage.User = currentUser;
            markedImage.UniqueMark = currentUser.Id + "#" + currentUser.NumberOfImagesMarked;


            string signature = "\\" + TesseractDetection.convertIntToBinarySignature(currentUser.Id) + "#" + TesseractDetection.convertIntToBinarySignature(currentUser.NumberOfImagesMarked) + "#";
            byte[] markedImageBinary = OpenStego.WatermarkImage(radio, signature, fileBytes, transparentSignatureBackground);
            byte[] embeddedAndMarkedImageBinary = OpenStego.EmbedData(markedImage.UniqueMark, markedImageBinary, imageName);

            markedImage.MarkedImageBinary = embeddedAndMarkedImageBinary;
            response.Status = ResultStatus.Success;

            try
            {
                _dbContext.Image.Add(markedImage);
                _dbContext.SaveChanges();
            }
            catch (Exception e)
            {
                Console.Write(e);
                response.Status = ResultStatus.Error;
                response.Message = e.ToString();
            }
            
            response.SignedImageId = markedImage.Id;

            return response;
        }
        public ActionResult FileUpload(HttpPostedFileBase file, int radio, bool whiteSignatureBackground)
        {
            Debug.Print("checkbox: " + whiteSignatureBackground.ToString());
            var model = new FileUploadViewModel();
            if (file != null)
            {
                var fileContentType = file.ContentType;
                if (!fileContentType.Contains("image"))
                {
                    model.errorMessage = "You must select a jpeg or png file to upload";
                    ViewBag.Title = "Upload Page";
                    ViewBag.Link = "";
                    ViewBag.Hidden = "display: none";
                    return View("Index", model);
                }

                string imageName = Path.GetFileName(file.FileName);
                using (MemoryStream ms = new MemoryStream())
                {
                    file.InputStream.CopyTo(ms);
                    byte[] fileArray = ms.GetBuffer();
                    ms.Close();
                    int currentUserId;
                    FileUploadResponse fileUploadResponse = new FileUploadResponse() { Status = ResultStatus.Error } ;
                    if (int.TryParse(Request.LogonUserIdentity.GetUserId(), out currentUserId))
                        fileUploadResponse = _fps.FileUpload(currentUserId, fileArray, imageName, radio, !whiteSignatureBackground);

                    if (fileUploadResponse.Status == ResultStatus.Error)
                    {
                        //do error handling here 
                    }
                    else
                    {
                        var imageData = _fps.GetImageById(fileUploadResponse.SignedImageId).ImageBinary;
                        return File(imageData, "image/png");
                    }
                }
            }

            model = new FileUploadViewModel();
            model.errorMessage = "You must select a jpeg or png file to upload";
            ViewBag.Title = "Upload Page";
            ViewBag.Link = "";
            ViewBag.Hidden = "display: none";
            return View("Index", model);
        }