made repo optional for entity creation

and provided means to attach entity to repo later