public RegistrationResponse Registration(ISession session, RegistrationRequest request) { var response = request.CreateResponse <RegistrationResponse>(); if (string.IsNullOrWhiteSpace(request.DeviceId) || request.UserId < 1 || request.PublicKey.IsNullOrEmpty()) { response.Success = false; return(response); } _devicesRepository.AddDevice(request.UserId, request.DeviceId); _devicesRepository.SetPublicKeyForDevice(request.DeviceId, request.PublicKey); return(response); }