public IHttpActionResult PutFriend(int id, Friend friend)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != friend.Id)
            {
                return BadRequest();
            }

            _db.Entry(friend).State = EntityState.Modified;

            try
            {
                _db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FriendExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
        public IHttpActionResult PostFriend(Friend friend)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var userdevice = UserManager.FindByName(User.Identity.Name);
            var user = _db.Users.First(node => node.Id == userdevice.UserId);

            if (friend.UserId != user.Id)
            {
                return BadRequest("Bad Request: Can't Set another users friend");
            }

            if (_db.Blocked.Any(node => node.BlockUserId 
            == friend.UserId && node.UserId == friend.FriendUserId))
            {
                return BadRequest("Bad Request: Can't add as friend");
            }

            _db.Friends.Add(friend);
            _db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = friend.Id }, friend);
        }