Fixed the api for adding group.
Refactoring api for creating group.