public HttpResponseMessage Post()
 {
     try
     {
         var login = Request.Headers.GetValues("login").Single();
         var password = Request.Headers.GetValues("password").Single();
         var id = CheckUser(login, password);
         if (id != null)
         {
             var sessionId = HashHelper.CreateSessionId();
             using (var client = new CacheClient())
             {
                 client.SetCookie(sessionId, id.Value);
             }
             return Request.CreateResponse(HttpStatusCode.OK,new SessionDto
             {
                 Id = id,
                 Cookie = sessionId
             });
         }
         return Request.CreateResponse(HttpStatusCode.Forbidden, new SessionDto());
     }
     catch (Exception)
     {
         return Request.CreateResponse(HttpStatusCode.InternalServerError);
     }
 }
 public HttpResponseMessage Get()
 {
     try
     {
         var sessionId = Request.Headers.GetValues("sessionId").Single();
         using (var client = new CacheClient())
         {
             var res = new SessionDto
             {
                 Cookie = sessionId,
                 Id = client.GetUserId(sessionId)
             };
             return Request.CreateResponse<SessionDto>(HttpStatusCode.OK, res);
         }
     }
     catch (Exception)
     {
         return Request.CreateResponse(HttpStatusCode.InternalServerError);
     }
 }