public IHttpActionResult PutFile(FileModel file)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            // TODO Add validations
            this.Data.Files
                .Find(file.Id)
                .Link = file.Link;

            try
            {
                this.Data.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FileExists(file.Id))
                {
                    return NotFound();
                }
                else
                {
                    throw new ArgumentException("The file Id wasn't valid");
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
        private IHttpActionResult ValidatePicture(FileModel file)
        {
            var dbContext = new Data.ApplicationDbContext();

            if (file.ApplicationUserId == null ||
                !dbContext.Users
                .Any(x => x.Id == file.ApplicationUserId.ToString()))
            {
                return BadRequest("ApplicationUserId NOT FOUND");
            }

            if (file.Link == null || !file.Link.StartsWith("https://"))
            {
                return BadRequest("Invalid Url");

            }

            return Ok();
        }
        public IHttpActionResult PostFile(FileModel file)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            int userId = int.Parse(User.Identity.GetUserId());
            var user = Data.Users.Find(userId);

            string subPath = "ImagesPath"; // your code goes here

            bool exists = System.IO.Directory.Exists(HttpContext.Current.Server.MapPath("Images"));

            //if (!exists)
            //    System.IO.Directory.CreateDirectory(Server.MapPath(subPath));

            this.Data.Files
                     .Add(new File()
                     {
                         ApplicationUserId = file.ApplicationUserId,
                         Link = file.Link
                     });

            this.Data.SaveChanges();
            return CreatedAtRoute("DefaultApi", new { id = file.Id }, file);
        }