---
# System prepended metadata

title: Refactor function detectUser

---

# Refactor function detectUser

## Problem
Logic of detecting entity and registring (if entity not found) differs for every platform, it is performed on core, so it will be hard to scale when new platform appears.

## What to do?
We propose to move these different logics to corresponding workers, so they perform during handling new Message from platform before being sent to core. 

## Pros
less confusion, better scalability

## Variants of implementation

### 1) Completely move logic to workers
### 2) Creaty API routes on workers for geting Entity, so core only needs to make api request 
![](https://i.imgur.com/LCLkxsF.png)

